Skip to content

Extreme make over #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Oct 10, 2017
Merged

Extreme make over #17

merged 25 commits into from
Oct 10, 2017

Conversation

filipesperandio
Copy link
Contributor

@filipesperandio filipesperandio commented Oct 4, 2017

I recommend reviewing by navigating the branch instead of looking at diffs as this is a complete new structure.

  • New tooling
  • Bring released versions of sonarlint-cli, sonarlint-core and sonarlint-client-api
  • Apply extensions on top of them
  • Keep only files that matter
  • Sanity Check Test

Related: qltysh/qlty#746

README.md Outdated

Copyright 2016-2017 SonarSource.

Licensed under the [GNU Lesser General Public License, Version 3.0](http://www.gnu.org/licenses/lgpl.txt)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we keep a README.md file?

NOTICE.txt Outdated
mailto:info AT sonarsource DOT com

This product includes software developed at
SonarSource (http://www.sonarsource.com/).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure of the licensing details but we may be required to keep this notice?

Makefile Outdated

test: image
docker run --rm -ti -w /usr/src/app -u root $(IMAGE_NAME) ./gradlew clean test

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💄 extra line

}
} else {
lines.addProperty("begin", 1);
lines.addProperty("end", 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that this is not new, and was in the code before this PR

This seems a little risky. If we don't have a reliable location information for an issue, we probably shouldn't output it at all.

Do we know of issues that should apply generally to the file and not to a specific block of source code?

Wondering if we should just emit a warning here instead of emitting an issue with bad data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dblandin Yeah, I am not very happy with this class either.
I am creating an gh-issue with these points and will address those in another PR, WTDY?

Copy link

@dblandin dblandin Oct 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

Would you mind commenting here with that issue link when it's available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsonObject content = new JsonObject();
json.add("content", content);
content.addProperty("body", ruleDetails.getHtmlDescription());
// // ruleDetails.getExtendedDescription();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does #getExtendedDescription contain? Do we still need this comment?

}
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably drop this generated file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixture for testing.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, cool cool 👍

Library classUnderTest = new Library();
assertTrue("someLibraryMethod should return 'true'", classUnderTest.someLibraryMethod());
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably drop this generated file.

gradlew Outdated
@@ -0,0 +1,172 @@
#!/usr/bin/env sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented on the Dockerfile as well but I'm wondering if we can use the package manager for the gradle install instead of committing this script.

* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonarlint.cli;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right package for this class? Should it com.codeclimate.engine or something like that? Doesn't seem like it's meant to be part of sonarlint itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only put this here because of some package protected methods we need access.
Already working to improve this in another branch, if it is OK to leave it as is for now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, interesting. Yeah, in that case it's probably fine to leave as is. Would be great to minimize dependencies on protected methods in general.

import static org.sonarlint.cli.SonarProperties.PROJECT_HOME;


public class CustomMain extends org.sonarlint.cli.Main {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we can pick a better name than CustomMain. Maybe Engine if this is meant to be the engine wrapper around sonarlint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about SonarlintWrapper?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that sounds good to me. Maybe even SonarlintEngineWrapper to be more specific.

@filipesperandio
Copy link
Contributor Author

@dblandin Thanks for the feedbacks:

  • Dockerfile changes include gradle installation and project dependencies caching
  • Removed gradlew files
  • No more /code-read-write
  • NOTICE/LICENSE/README are back
  • CustomMain: saving the renaming to another PR as the other branch already has a bunch of changes
  • Fixed WORKDIR /code

Appreciate another look at it if you have time!

@dblandin
Copy link

dblandin commented Oct 9, 2017

@filipesperandio Are there commits that haven't been pushed up yet?

I still see references to /code-read-write and I'm not seeing the gradle installation.

@filipesperandio
Copy link
Contributor Author

@dblandin My bad. Everything pushed now.

/usr/src/app/dest/bin/sonarlint \
--src 'src/main/**/*.java'
WORKDIR /code
CMD cp -R /code /tmp/ && /usr/src/app/build/codeclimate-sonar /tmp/code
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like sonarlint supports a SONARLINT_USER_HOME environment variable. Could that be used to redirect the tool's output to another directory, leaving the source code under analysis untouched in /code?

SonarSource/sonarlint-core@220729b#diff-fc98b7a351de15143748ac690d4fc601

Trying to find a way to avoid this cp -R workaround.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dblandin Didn't work. That reference seems outdated.
I think we can override it somewhere, but I would like to approach this in a separate PR as well. If it is OK for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me 👍

@filipesperandio filipesperandio merged commit 6beeb56 into channel/beta Oct 10, 2017
@filipesperandio filipesperandio deleted the fe/new-structure branch October 13, 2017 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants