-
Notifications
You must be signed in to change notification settings - Fork 1
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
Splitting intellij module into 3 modules: core, java-psi, kotlin-psi #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I have several comments.
1). I think the structure of the main
and test
folders should be consistent. For example, there is an inconsistency in the kotlin-psi
module: org/jetbrains/academy/test/kotlin
and org/jetbrains/academy/test/system/ij/kotlin
. In one case you use system
and in another you don't.
2). It's not needed to add .gitignore
to each module, we need one .gitingore
file in the root folder.
3). I suggest renaming ij.core
to ij.common
, but it's a very minor thing.
Please, let me know what you think about.
@onewhl Thank you! About item (2) - the formatting check is the same for both Java and Kotlin, but the tests are different for them, that's why I defined it that way. But I can write tests for Java and Kotlin for the formatting function in a common module. |
@anchouls yes, I get it, you're absolutely right, I already removed the comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
I'm only not sure if we need to update intellij
version to 1.15.0
in this PR, but if it breaks nothing, maybe it's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please bump the framework version. I also committed a small change of the main gradle, hope you don't mind
@@ -1,4 +1,4 @@ | |||
package org.jetbrains.academy.test.system.ij.analyzer | |||
package org.jetbrains.academy.test.system.kotlin.ij.analyzer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this file has to be moved into the common module since it works with PSI elements, not with KtElements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It works with KtElements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now you have a lot of the same methods in Java and Kotlin modules, e.g.
fun PsiFile.hasClass(className: String): Boolean = hasElementOfTypeWithName(PsiClass::class.java, className
and
fun PsiFile.hasClass(className: String): Boolean = hasElementOfTypeWithName(KtClass::class.java, className)
Instead it you can move these methods in the ij core module and here just call them with necessary arguments
92fca18
to
4c72002
Compare
4c72002
to
56ca009
Compare
ij/common/src/main/kotlin/org/jetbrains/academy/test/system/inspections/InspectionsUtil.kt
Outdated
Show resolved
Hide resolved
ij/common/src/main/kotlin/org/jetbrains/academy/test/system/inspections/InspectionsUtil.kt
Outdated
Show resolved
Hide resolved
...psi/src/main/kotlin/org/jetbrains/academy/test/system/java/ij/analyzer/IjCodeAnalyzerUtil.kt
Outdated
Show resolved
Hide resolved
...i/src/main/kotlin/org/jetbrains/academy/test/system/kotlin/ij/analyzer/IjCodeAnalyzerUtil.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I have several suggestions
@@ -0,0 +1,196 @@ | |||
package org.jetbrains.academy.test.system.java.ij.analyzer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to separate this file into several ones, since it is loo long now, e.g.:
PsiFileAnalyzerUtil
IjCodeAnalyzerUtil
PsiElementAnalyzerUtil
What do you think?
var methodName = "method(\"Content\")" | ||
var methodsList = listOf("outerFunction", "method2") | ||
assert(methodsList.equals(findMethodUsages(methodName))) { | ||
"Method $methodName should be called in methods: $methodsList" | ||
} | ||
methodName = "method(\"y is greater than 5\")" | ||
methodsList = listOf("method1") | ||
assert(methodsList.equals(findMethodUsages(methodName))) { | ||
"Method $methodName should be called in methods: $methodsList" | ||
} | ||
methodName = "method(\"y is less than 5\")" | ||
methodsList = listOf("method1") | ||
assert(methodsList.equals(findMethodUsages(methodName))) { | ||
"Method $methodName should be called in methods: $methodsList" | ||
} | ||
methodName = "method(content)" | ||
methodsList = listOf() | ||
assert(methodsList.equals(findMethodUsages(methodName))) { | ||
"Method $methodName should not be called" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change this test into a parametrized one?
|
||
class BaseIjTestClassTests : BaseIjTestClass() { | ||
|
||
fun testFindMethodsWithContent() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also make this test as a parametrized one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or at least to move common functionality and call a function here
} | ||
""".trimIndent() | ||
myFixture.configureByText("Task.java", example) | ||
var expression = "productPrice.size()" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -1,4 +1,4 @@ | |||
package org.jetbrains.academy.test.system.ij.analyzer | |||
package org.jetbrains.academy.test.system.kotlin.ij.analyzer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now you have a lot of the same methods in Java and Kotlin modules, e.g.
fun PsiFile.hasClass(className: String): Boolean = hasElementOfTypeWithName(PsiClass::class.java, className
and
fun PsiFile.hasClass(className: String): Boolean = hasElementOfTypeWithName(KtClass::class.java, className)
Instead it you can move these methods in the ij core module and here just call them with necessary arguments
…rameterized tests
c85157d
to
94dce6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
No description provided.