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

Update doc for UniqueProperties #7595

Closed
timurt opened this issue Feb 23, 2020 · 3 comments · Fixed by #9273
Closed

Update doc for UniqueProperties #7595

timurt opened this issue Feb 23, 2020 · 3 comments · Fixed by #9273

Comments

@timurt
Copy link
Contributor

timurt commented Feb 23, 2020

https://checkstyle.org/config_misc.html#UniqueProperties

Add example for each existing config to show what code is ok and what code cause violation.
Good example is https://checkstyle.org/config_naming.html#AbstractClassName

please play with module/Check by means of https://checkstyle.org/cmdline.html to understand how it works.


PLEASE READ https://github.com/checkstyle/checkstyle/wiki/Good-practice-on-how-to-update-examples

ImmortalRabbit added a commit to ImmortalRabbit/checkstyle that referenced this issue Apr 21, 2020
ImmortalRabbit added a commit to ImmortalRabbit/checkstyle that referenced this issue Apr 21, 2020
@checkstyle checkstyle deleted a comment from ImmortalRabbit Feb 11, 2021
@Divesh2201
Copy link
Contributor

Am working on it.

@Divesh2201
Copy link
Contributor

I have added examples for the Check. Request the admins to verify and point out any changes if required, then I will commit and create PR for the same, after your green signal.

Was Before

Screenshot from 2021-02-12 15-03-19

Is Now

Screenshot from 2021-02-12 17-21-26
Screenshot from 2021-02-12 17-21-41
Screenshot from 2021-02-12 17-21-45

To configure the check:

$ cat cnf.xml

<!DOCTYPE module PUBLIC
          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
	<module name="UniqueProperties"/>
</module>

$ cat app.properties

key.one=44
key.two=32 
key.one=54

$ java -jar checkstyle-8.40-all.jar -c cnf.xml app.properties

Starting audit...
[ERROR] /home/divesh/Desktop/app.properties:1: Duplicated property 'key.one' (2 occurrence(s)). [UniqueProperties]
Audit done.
Checkstyle ends with 1 errors.

To configure the check to scan custom file extensions:

$ cat cnf.xml

<!DOCTYPE module PUBLIC
          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
	<module name="UniqueProperties">
  		<property name="fileExtensions" value="customproperties"/>
	</module>
</module>

$ cat app.customproperties

key.one=44
key.two=32 
key.one=54 

$ java -jar checkstyle-8.40-all.jar -c cnf.xml app.customproperties

Starting audit...
[ERROR] /home/divesh/Desktop/app.customproperties:1: Duplicated property 'key.one' (2 occurrence(s)). [UniqueProperties]
Audit done.
Checkstyle ends with 1 errors.

$ cat app.properties

key.one=44
key.two=32 
key.one=54 

$ java -jar checkstyle-8.40-all.jar -c cnf.xml app.properties

Starting audit...
Audit done.

To configure the check to scan custom file extensions and properties file:

$ cat cnf.xml

<!DOCTYPE module PUBLIC
          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
	<module name="UniqueProperties">
  		<property name="fileExtensions" value="properties, customproperties"/>
	</module>
</module>

$ cat app.customproperties

key.one=44
key.two=32 
key.one=54 

$ java -jar checkstyle-8.40-all.jar -c cnf.xml app.customproperties

Starting audit...
[ERROR] /home/divesh/Desktop/app.customproperties:1: Duplicated property 'key.one' (2 occurrence(s)). [UniqueProperties]
Audit done.
Checkstyle ends with 1 errors.

$ cat app.properties

key.one=44
key.two=32 
key.one=54 

$ java -jar checkstyle-8.40-all.jar -c cnf.xml app.properties

Starting audit...
[ERROR] /home/divesh/Desktop/app.properties:1: Duplicated property 'key.one' (2 occurrence(s)). [UniqueProperties]
Audit done.
Checkstyle ends with 1 errors.

Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 12, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 13, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Issue checkstyle#7595: Update docs for UniqueProperties

Issue checkstyle#7595: Update docs for UniqueProperties

Issue checkstyle#7595: Update docs for UniqueProperties

Issue checkstyle#7595: Update docs for UniqueProperties
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
Divesh2201 added a commit to Divesh2201/checkstyle that referenced this issue Feb 14, 2021
@romani romani added this to the 8.41 milestone Feb 15, 2021
@romani
Copy link
Member

romani commented Feb 15, 2021

fix is merged

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

Successfully merging a pull request may close this issue.

3 participants