You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rootPackage config for InvalidPackageDeclaration allows us to account for a file path that doesn't include the root part of the package, but it doesn't check that the package declaration contains this rootPackage. This can lead to inconsistency, for example:
with config rootPackage: 'my.root.package' file/path containing a file with package my.root.package.file.path passes as expected file/path containing a file with package file.path also passes
Expected Behavior of the rule
The rule should ensure that all classes in a given file path have the same package declaration. This means that if a rootPackage is defined, it should also enforce that it is present in the package declaration.
Context
For bettor or worse I work in a codebase that has a file structure that does not contain the root directories for kotlin src files which allows these inconsistencies to arise...
The text was updated successfully, but these errors were encountered:
I think this is a nice improvement. However, I would like to point out how this is a behavior change. Specifically, before the rootPackage was used just to ignore part of the package declaration.
Please also note how this is explained in the documentation:
The
rootPackage
config forInvalidPackageDeclaration
allows us to account for a file path that doesn't include the root part of the package, but it doesn't check that the package declaration contains thisrootPackage
. This can lead to inconsistency, for example:with config
rootPackage: 'my.root.package'
file/path
containing a file withpackage my.root.package.file.path
passes as expectedfile/path
containing a file withpackage file.path
also passesExpected Behavior of the rule
The rule should ensure that all classes in a given file path have the same package declaration. This means that if a
rootPackage
is defined, it should also enforce that it is present in the package declaration.Context
For bettor or worse I work in a codebase that has a file structure that does not contain the root directories for kotlin src files which allows these inconsistencies to arise...
The text was updated successfully, but these errors were encountered: