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

KON-616 Add ability to pass collections to functions in providers #974

Conversation

nataliapeterwas
Copy link
Collaborator

@nataliapeterwas nataliapeterwas commented Mar 27, 2024

Added:

  1. Possibility to create scope passing any collection of items

    Before

    // Option 1
    Konsist
    	.scopeFromFiles(path1, path2, path3)
    	...
    
    // Option 2
    val paths = setOf(path1, path2, path3)
    Konsist
    	.scopeFromFiles(paths)
    	...

    After - you additionally may pass any collection of items:

    // Option 1 and Option 2 still works
    
    // Option 3
    val paths = listOf(path1, path2, path3)
    Konsist
    	.scopeFromFiles(paths)
    	...
  2. Possibility to pass any collection of items in provider methods where few parameters could be passed using the vararg modifier

    Before

    // Option 1
    Konsist
    	.scopeFromProject()
    	.classes()
    	.hasAnnotationWithName(name1, name2, name3)
    	...

    After - you additionally may pass any collection of items:

    // Option 1 still works
    
    // Option 2
    val names = setOf(name1, name2, name3)
    Konsist
    	.scopeFromProject()
    	.classes()
    	.hasAnnotationWithName(names)
    	...
    
    // Option 3
    val names = listOf(name1, name2, name3)
    Konsist
    	.scopeFromProject()
    	.classes()
    	.hasAnnotationWithName(names)
    	...

Copy link

@nataliapeterwas nataliapeterwas marked this pull request as ready for review March 28, 2024 22:45
@nataliapeterwas nataliapeterwas added the improvement nhancements to existing features or code label Mar 28, 2024
@igorwojda igorwojda merged commit cc4ce84 into develop Apr 1, 2024
31 checks passed
@igorwojda igorwojda deleted the KON-616-add-ability-to-pass-collections-to-functions-in-providers branch April 1, 2024 09:34
igorwojda pushed a commit that referenced this pull request Apr 1, 2024
* upd konsist test

* add additional methods to KoModifierProvider

* add additional methods to KoKDocTagProvider

* add additional methods to KoAnnotationProvider and KoArgumentProvider

* add additional methods to KoChildProvider

* clean code

* add additional methods to KoClassProvider

* add additional methods to KoEnumConstantProvider

* add additional methods to KoExternalParentProvider

* add additional methods to KoFunctionProvider

* add additional methods to KoImportAliasProvider

* add additional methods to KoImportProvider

* add additional methods to KoInterfaceProvider

* clean code

* add additional methods to KoLocalClassProvider

* add additional methods to KoLocalFunctionProvider

* add additional methods to KoObjectProvider

* add additional methods to KoParametersProvider

* add additional methods to KoParentClassProvider

* clean code

* add additional methods to KoParentInterfaceProvider

* clean code

* add additional methods to KoParentProvider

* clean code

* add additional methods to KoPropertyProvider

* add additional methods to KoTypeAliasProvider

* add additional methods to KoVariableProvider

* clean code

* remove code like `names.first(), *names.drop(1).toTypedArray()`

* clean code

* add possibility to pass all collections as parameter during scope creation

* upd tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement nhancements to existing features or code
Projects
None yet
2 participants