Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Lexicographic ordering can seem a bit off #18

Closed
Chesire opened this issue Nov 12, 2019 · 2 comments
Closed

Lexicographic ordering can seem a bit off #18

Chesire opened this issue Nov 12, 2019 · 2 comments

Comments

@Chesire
Copy link
Owner

Chesire commented Nov 12, 2019

When using the Lexicographic ordering lint rule, since it is completely based on lexicographic ordering it takes into account : and . characters, causing an odd order when having multiple libraries from the same person.

ex:

 implementation 'com.chesire.lintrules:lint-gradle:1.1.0'
 implementation 'com.chesire.lintrules:lint-xml:1.1.0'
 implementation 'com.chesire:lifecyklelog:2.1.0'

is valid, whereas

 implementation 'com.chesire:lifecyklelog:2.1.0'
 implementation 'com.chesire.lintrules:lint-gradle:1.1.0'
 implementation 'com.chesire.lintrules:lint-xml:1.1.0'

should be valid instead.

@Chesire
Copy link
Owner Author

Chesire commented Nov 12, 2019

        dependencyItems
            .lastOrNull()
            ?.onlyIf({
                first == property && second.compareTo(dependency, false) > 0
            }, {
                context.report(
                    LexicographicDependencies.issue,
                    context.getLocation(valueCookie),
                    LexicographicDependencies.message
                )
            })

Needs to be a little smarter when doing the compareTo section, to stop once it encounters a :

@Chesire
Copy link
Owner Author

Chesire commented Nov 14, 2019

This has been fixed by #21.

@Chesire Chesire closed this as completed Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant