-
Notifications
You must be signed in to change notification settings - Fork 363
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
move sensors to own library #1099
move sensors to own library #1099
Conversation
@guwirth this is a initial implementation. for now only preparatory work to take the sensors out into a reusable library. once this is ready i will create a dedicated pr for c plugin |
ec3434f
to
083deac
Compare
move files move project builder
5d9c6b2
to
e11c793
Compare
@guwirth this is ready, i think |
massive refactoring, without touching integration tests and everything works :) |
@jmecosta Sounds good will have a look... |
@jmecosta looking over the code without testing it it looks good.
|
@@ -293,4 +334,11 @@ private int saveViolations(InputFile inputFile, SourceFile squidFile, SensorCont | |||
public String toString() { | |||
return getClass().getSimpleName(); | |||
} | |||
|
|||
//@Override | |||
//public List<Metric> getMetrics() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
@Override | ||
public String[] getFileSuffixes() { | ||
return new String [] {"cpp", "hpp", "h", "hxx", "cxx"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is getSourceFileSuffixes + getHeaderFileSuffixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, but it takes less code to do this. we on the next pr we should clarify a bit better this behaviour
@@ -48,7 +50,7 @@ public void test() { | |||
RulesDefinition.Repository repository = context.repository(REPOSITORY_KEY); | |||
|
|||
assertThat(repository.name()).isEqualTo(REPOSITORY_NAME); | |||
assertThat(repository.language()).isEqualTo(CxxLanguage.KEY); | |||
assertThat(repository.language()).isEqualTo("c++"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'c++' hard coded. Is there no function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -167,7 +177,7 @@ | |||
private static List<PropertyDefinition> codeAnalysisProperties() { | |||
String subcateg = "(2) Code analysis"; | |||
return new ArrayList<>(Arrays.asList( | |||
PropertyDefinition.builder(CxxCppCheckSensor.REPORT_PATH_KEY) | |||
PropertyDefinition.builder("sonar.cxx." + CxxCppCheckSensor.REPORT_PATH_KEY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard coded string 'sonar.cxx': better use a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@guwirth this pr should not introduce any regression. this is meant only as a preparatory work to introduce the c plugin. That will go in once this is merged. when we have the c plugin, the only regression ive identified was related with "sonar.cxx.suffixes.sources" and headers, basically if we dont change the prop name then all users that use both plugin will need to manually modify their values to remove the c extensions. if changing the name of the prop and include only the c++ prefix then you are forcing people to use the 2 plugins. For me to reduce regression, i would not change the prop nor the prefix. And mention in documentation that if a c plugin is to be used then you must update the default extensions in the c++ plugin only to include c++ extensions. |
@guwirth should i merge then? |
Yes, would merge. Makes it easier to continue.
|
separate all sensors into own library, connect the cxx plugin to it.