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

CNC_COLLECTION_NAMING_CONFUSION should match entire words only #405

Open
sabberworm opened this issue Aug 3, 2020 · 1 comment
Open

Comments

@sabberworm
Copy link

I’ve had some false positives with CNC_COLLECTION_NAMING_CONFUSION when using names like offset, asset for collections that were not sets.

I think CNC_COLLECTION_NAMING_CONFUSION should only match if the magic words it searches for (map/set/list/queue) are single words on camel/snake case boundaries.

For example, the following should match:

  • map
  • Map
  • MAP
  • asSet
  • SOME_SET

While these shouldn’t:

  • asset
  • spielbergsEt
  • runNmap
  • COMMAND_NMAP
  • TAG_NAMES_LI_ST

Also, I’m not sure why you’re excluding toset from the check. Shouldn’t a method named toSet usually return a set?

I suggest you also include checks for the words deque and stack (which should match the java.util.Deque interface).

@sabberworm sabberworm changed the title CNC_COLLECTION_NAMING_CONFUSION should match entire words CNC_COLLECTION_NAMING_CONFUSION should match entire words only Aug 3, 2020
@romani
Copy link

romani commented Jul 3, 2023

better to avoid deque in naming,
same problem checkstyle/checkstyle#12855 (comment)

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

No branches or pull requests

2 participants