Skip to content
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

Remove property keywords because of conflict in inline command configration parameters #132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

talha-inozu
Copy link

@talha-inozu talha-inozu commented Mar 14, 2024

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MCHECKSTYLE-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MCHECKSTYLE-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@talha-inozu
Copy link
Author

talha-inozu commented Mar 14, 2024

Due to the property fields, when the mvn clean install command is executed, it applies the check command in the specified configurations, but when we run the mvn checkstyle:check command as an inline command, it cannot read the config variables in the pom because the property name and itself are different.

Example:
In pom.xml
<configuration> <configLocation>my_checks.xml</configLocation> </configuration>
But at the code:
@Parameter(property = "checkstyle.config.location", defaultValue = DEFAULT_CONFIG_LOCATION) = protected String configLocation;

You can see that configLocation and checkstyle.config.location conflicts

Because of checkstyle.config.location , mvn checkstyle:check command doesnt see the configureLocation.

@slawekjaranowski
Copy link
Member

Example: In pom.xml <configuration> <configLocation>my_checks.xml</configLocation> </configuration> But at the code: @Parameter(property = "checkstyle.config.location", defaultValue = DEFAULT_CONFIG_LOCATION) = protected String configLocation;

You can see that configLocation and checkstyle.config.location conflicts

Because of checkstyle.config.location , mvn checkstyle:check command doesnt see the configureLocation.

There is no conflicts .... simply properties is used to assign configuration values for not mentioned options
If you have configuration in pom in static way - properties are not used any more ...

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

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

We can not remove properties .. it will break many configurations.

For such change we need an issue to proper documents it.

@talha-inozu
Copy link
Author

talha-inozu commented Apr 4, 2024

Example: In pom.xml <configuration> <configLocation>my_checks.xml</configLocation> </configuration> But at the code: @Parameter(property = "checkstyle.config.location", defaultValue = DEFAULT_CONFIG_LOCATION) = protected String configLocation;
You can see that configLocation and checkstyle.config.location conflicts
Because of checkstyle.config.location , mvn checkstyle:check command doesnt see the configureLocation.

There is no conflicts .... simply properties is used to assign configuration values for not mentioned options If you have configuration in pom in static way - properties are not used any more ...

Yes, I know, but even though I have defined it statically in the pom, when I run it from cmd as mvn checkstyle:check, it does not see the configLocation section in the pom. If I run it as an inline command and I define it as static in the pom, only those with the same property name can be used. I followed the steps I saw in the checklist and when I removed the properties, there was no error and as far as I can see, it was fixed. Can you check it again?

When I run it inline and give statically configLocation in the pom, it cannot bind because the @parameter porperty name is not the same with pom config name and than it uses the default value.

Also, when I delete only the properties in the @parameter sections, the variable can still be used as a parameter in the inline command with its own name, that is, the names in the pom. Is this a problem? When I did this, it passed all the tests with mvn verify.

@slawekjaranowski
Copy link
Member

Please create JIRA issue for it with sample projects and instruction how to execute, what result is and what result is expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants