Skip to content

Commit

Permalink
Avoid running Ruff on .rst files (#5, #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo authored Sep 20, 2024
1 parent 7b1e855 commit 6b0417f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/insyncwithfoo/ryecharm/PathsAndFiles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,16 @@ internal val VirtualFile.isRuffToml: Boolean
get() = name == "ruff.toml" || name == ".ruff.toml"


// https://github.com/InSyncWithFoo/ryecharm/issues/5
private val PsiFile.isReST: Boolean
get() = virtualFile?.extension == "rst"


// TODO: .ipynb / Allow configuring what files
internal fun VirtualFile.isSupportedByRuff(project: Project? = null): Boolean {
return extension == "py" || extension == "pyi"
}


internal val PsiFile.isSupportedByRuff: Boolean
get() = this is PyFile || virtualFile?.isSupportedByRuff(project) == true
get() = this is PyFile && !this.isReST || virtualFile?.isSupportedByRuff(project) == true

0 comments on commit 6b0417f

Please sign in to comment.