Checker Cache and TranslationCheck conflict #3539

Open
romani opened this Issue Nov 10, 2016 · 1 comment

Projects

None yet

1 participant

@romani
Member
romani commented Nov 10, 2016 edited

TranslationCheck looks at multiple files, and only does validation ONLY after all the files are given to it.
If some file was in cache and so skipped by Checker(non of Checks is called to consider it), it creates and situation that TranslationCheck does not see some files - so report violation.

Processing 1 file and skipping others will cause it to falsely believe that files are missing and report excess violations, even when no violations on a non-cache run exist. This is because we don't guess were the files are, we use the files reported to the check to know where they are and if they exist.

Steps to reproduce on CS locally:

  1. Clean target directory of any cache file.
  2. Run checkstyle's ant-phase-verify with cache on. No violations are produced but cache file is created
  3. Add '.' to any value at \src\main\resources\com\puppycrawl\tools\checkstyle\checks\naming\messages_es.properties.
  4. Run checkstyle again and this time 8 violations are reported, even though no files were modified and we got no violations on our first run in step 2.
    Below is the output:
Starting audit...
[ERROR] ...\checks\naming:0: Properties file 'messages.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_de.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_fi.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_pt.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_ja.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_fr.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_tr.properties' is missing. [Translation]
[ERROR] ...\checks\naming:0: Properties file 'messages_zh.properties' is missing. [Translation]
Audit done.
Checkstyle ends with 8 errors.

Expected: no violations.

Commit 441d2d3 need to be reverted as fix for issue is provided.

Original problem was reported and discussed at: #3493

@romani
Member
romani commented Nov 10, 2016 edited

This is unfortunate mis-design of TranslationCheck, we can not fix it easily.
Users need to be aware of it if they use caching (all IDE plugins use caching).

There are no problems with validation logic of this Check if validation is launched on just cloned sources (no existing cache scenario).

This issue could be fixed only after "Support multi-file validation Checks in Checkstyle" - #3540 .

@romani romani added the approved label Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment