[Codenarc-developer] Contributing (potentially) contentious rules to CodeNarc
Brought to you by:
chrismair
From: Marcin E. <mar...@pr...> - 2017-03-03 14:11:57
|
I'm looking into contributing two rules I'm working on at the moment. I see them being potentially contentious and would like to ask if they have a chance of being accepted before putting in the effort to submit a PR. I'm fairly sure that I will want to reuse them across my projects so I will most probably open source them stand alone if you don't see them being a fit for the set of core rules so don't feel bad saying no. The rules are: 1. MissingOverrideAnnotation - a rule which enforces annotating methods which override or implement other methods with @Override as suggested in "Item 36: Consistently use the Override annotation" of Joshua Bloch's "Effective Java". This rule requires SEMANTIC_ANALYSIS compiler phase. 2. CompilationModeNotSpecified - a rule which requires every class (apart from inner classes, depending on configuration) to be annotated with either @CompileStatic or @CompileDynamic. The rationale is that we want to compile statically all of our production classes (dynamic compilation of a class or method is allowed if explicitly enabled using @CompileDynamic). We could in theory use a compiler configuration to achieve that instead but support for these is limited in IntelliJ - configuration is applied to the whole project which means that we would have problems disabling static compilation for our tests and we clearly don't want to have different compilation modes between build and IDE if we were not to apply a compiler config in the IDE. I understand that all of the built-in rules are applied to CodeNarc's codebase. While the first rule might trigger a lot of violations I can see it being justified to add all these missing @Override annotations. The second rule is on the other hand highly opinionated and I don't see value in applying it to CodeNarc's code base. Would that mean that it's a bad candidate for the set of built-in rules? Thanks, Marcin |