From 64edfbaa7e6ed4579bf3e6f24d8b3decab23f869 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Fri, 21 Jul 2023 13:23:16 +0200 Subject: [PATCH] Constants should follow SCREAMING_SNAKE_CASE --- qodana.yaml | 4 +++ .../texifyidea/action/NewLatexFileAction.kt | 10 +++---- .../InsertGraphicWizardDialogWrapper.kt | 4 +-- .../texifyidea/grammar/BibtexLanguage.kt | 1 + .../texifyidea/grammar/LatexLanguage.kt | 1 + .../codestyle/LatexLineBreakInspection.kt | 4 +-- .../LatexEscapeUnderscoreInspection.kt | 3 +- .../LatexMoveSelectionToFileIntention.kt | 4 +-- .../texifyidea/lang/alias/CommandManager.kt | 3 +- .../texifyidea/modules/DefaultFileCreator.kt | 6 ++-- .../mendeley/MendeleyAuthenticator.kt | 20 ++++++------- .../mendeley/MendeleyCredentials.kt | 4 +-- .../run/latex/LatexConfigurationFactory.kt | 6 ++-- .../texifyidea/run/latex/LatexOutputPath.kt | 14 +++++----- .../run/latex/ui/LatexSettingsEditor.kt | 2 +- .../evince/EvinceConversation.kt | 6 ++-- .../run/sumatra/SumatraConversation.kt | 16 +++++------ .../texifyidea/settings/TexifySettings.kt | 3 +- .../texifyidea/settings/sdk/LatexSdkUtil.kt | 1 - .../templates/LatexTemplatesFactory.kt | 28 +++++++++---------- src/nl/hannahsten/texifyidea/ui/ImagePanel.kt | 2 +- src/nl/hannahsten/texifyidea/util/Log.kt | 10 +++---- .../texifyidea/util/magic/PatternMagic.kt | 4 +-- .../run/LatexRunConfigurationTest.kt | 4 +-- 24 files changed, 83 insertions(+), 77 deletions(-) diff --git a/qodana.yaml b/qodana.yaml index 692ef6810..f3cb39d45 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -28,6 +28,10 @@ exclude: # Some of these are valid inspections but not important or accurate eno - name: LanguageDetectionInspection - name: GrazieInspection - name: CheckDependencyLicenses # TeXiFy violates all sorts of licenses, don't care + - name: RetrievingService + paths: + # The class is unused, see TexifyProjectConfigurable + - src/nl/hannahsten/texifyidea/settings/TexifyProjectSettings.kt # Qodana false positives: - name: EmptyMethod - name: SameReturnValue diff --git a/src/nl/hannahsten/texifyidea/action/NewLatexFileAction.kt b/src/nl/hannahsten/texifyidea/action/NewLatexFileAction.kt index e48732004..4eb80ad69 100644 --- a/src/nl/hannahsten/texifyidea/action/NewLatexFileAction.kt +++ b/src/nl/hannahsten/texifyidea/action/NewLatexFileAction.kt @@ -56,11 +56,11 @@ class NewLatexFileAction : CreateElementActionBase("LaTeX File", "Create a new L private fun getTemplateNameFromExtension(extensionWithoutDot: String): String { return when (extensionWithoutDot) { - OPTION_STY_FILE -> LatexTemplatesFactory.fileTemplateSty - OPTION_CLS_FILE -> LatexTemplatesFactory.fileTemplateCls - OPTION_BIB_FILE -> LatexTemplatesFactory.fileTemplateBib - OPTION_TIKZ_FILE -> LatexTemplatesFactory.fileTemplateTikz - else -> LatexTemplatesFactory.fileTemplateTex + OPTION_STY_FILE -> LatexTemplatesFactory.FILE_TEMPLATE_STY + OPTION_CLS_FILE -> LatexTemplatesFactory.FILE_TEMPLATE_CLS + OPTION_BIB_FILE -> LatexTemplatesFactory.FILE_TEMPLATE_BIB + OPTION_TIKZ_FILE -> LatexTemplatesFactory.FILE_TEMPLATE_TIKZ + else -> LatexTemplatesFactory.FILE_TEMPLATE_TEX } } diff --git a/src/nl/hannahsten/texifyidea/action/wizard/graphic/InsertGraphicWizardDialogWrapper.kt b/src/nl/hannahsten/texifyidea/action/wizard/graphic/InsertGraphicWizardDialogWrapper.kt index a4faf5f91..5a0a2c16a 100644 --- a/src/nl/hannahsten/texifyidea/action/wizard/graphic/InsertGraphicWizardDialogWrapper.kt +++ b/src/nl/hannahsten/texifyidea/action/wizard/graphic/InsertGraphicWizardDialogWrapper.kt @@ -141,7 +141,7 @@ open class InsertGraphicWizardDialogWrapper(val initialFilePath: String = "") : val source = event.source as? JBCheckBox ?: error("Not a JBCheckBox!") // Add symbol if selected. if (source.isSelected && txtPosition.text.contains(location.symbol).not()) { - txtPosition.text = txtPosition.text + location.symbol + txtPosition.text += location.symbol } // Remove if deselected. else { @@ -272,7 +272,7 @@ open class InsertGraphicWizardDialogWrapper(val initialFilePath: String = "") : } // When there is something, append width property. else { - txtCustomOptions.text = txtCustomOptions.text + ",$fieldName=$text" + txtCustomOptions.text += ",$fieldName=$text" } } diff --git a/src/nl/hannahsten/texifyidea/grammar/BibtexLanguage.kt b/src/nl/hannahsten/texifyidea/grammar/BibtexLanguage.kt index 35b64dad8..94eef83c7 100644 --- a/src/nl/hannahsten/texifyidea/grammar/BibtexLanguage.kt +++ b/src/nl/hannahsten/texifyidea/grammar/BibtexLanguage.kt @@ -6,6 +6,7 @@ import com.intellij.lang.Language * @author Hannah Schellekens */ object BibtexLanguage : Language("Bibtex") { + private fun readResolve(): Any = BibtexLanguage override fun getDisplayName(): String = "BibTeX" } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/grammar/LatexLanguage.kt b/src/nl/hannahsten/texifyidea/grammar/LatexLanguage.kt index 5ddcc61e5..f34dea5f2 100644 --- a/src/nl/hannahsten/texifyidea/grammar/LatexLanguage.kt +++ b/src/nl/hannahsten/texifyidea/grammar/LatexLanguage.kt @@ -6,6 +6,7 @@ import com.intellij.lang.Language * @author Sten Wessel */ object LatexLanguage : Language("Latex") { + private fun readResolve(): Any = LatexLanguage override fun getDisplayName(): String { return "LaTeX" diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLineBreakInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLineBreakInspection.kt index 1f4db0a72..c0bbfc3d7 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLineBreakInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLineBreakInspection.kt @@ -15,7 +15,7 @@ import nl.hannahsten.texifyidea.psi.LatexNormalText import nl.hannahsten.texifyidea.util.* import nl.hannahsten.texifyidea.util.files.document import nl.hannahsten.texifyidea.util.magic.PatternMagic -import nl.hannahsten.texifyidea.util.magic.PatternMagic.sentenceEndPrefix +import nl.hannahsten.texifyidea.util.magic.PatternMagic.SENTENCE_END_PREFIX import nl.hannahsten.texifyidea.util.parser.childrenOfType import nl.hannahsten.texifyidea.util.parser.inMathContext import nl.hannahsten.texifyidea.util.parser.isComment @@ -63,7 +63,7 @@ open class LatexLineBreakInspection : TexifyInspectionBase() { // It may be that this inspection is incorrectly triggered on an abbreviation. // However, that means that the correct user action is to write a normal space after the abbreviation, // which is what we suggest with this quickfix. - val dotPlusSpace = "^$sentenceEndPrefix(\\.\\s)".toRegex().find(text.text.substring(startOffset, matcher.end()))?.groups?.get(0)?.range?.shiftRight(startOffset + 1) + val dotPlusSpace = "^$SENTENCE_END_PREFIX(\\.\\s)".toRegex().find(text.text.substring(startOffset, matcher.end()))?.groups?.get(0)?.range?.shiftRight(startOffset + 1) val normalSpaceFix = if (dotPlusSpace != null) LatexSpaceAfterAbbreviationInspection.NormalSpaceFix(dotPlusSpace) else null val fixes = listOfNotNull(InspectionFix(), normalSpaceFix).toTypedArray() diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexEscapeUnderscoreInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexEscapeUnderscoreInspection.kt index 796620ebe..4fdcce747 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexEscapeUnderscoreInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexEscapeUnderscoreInspection.kt @@ -5,9 +5,9 @@ import com.intellij.psi.PsiElement import nl.hannahsten.texifyidea.inspections.TexifyRegexInspection import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.psi.LatexNormalText +import nl.hannahsten.texifyidea.util.magic.CommandMagic import nl.hannahsten.texifyidea.util.parser.firstParentOfType import nl.hannahsten.texifyidea.util.parser.inMathContext -import nl.hannahsten.texifyidea.util.magic.CommandMagic import java.util.regex.Matcher import java.util.regex.Pattern @@ -29,7 +29,6 @@ class LatexEscapeUnderscoreInspection : TexifyRegexInspection( return super.checkContext(matcher, element) } - @Suppress("RedundantIf") private fun PsiElement.isUnderscoreAllowed(): Boolean { if (this.inMathContext()) return true if (this.firstParentOfType(LatexNormalText::class) != null) return false diff --git a/src/nl/hannahsten/texifyidea/intentions/LatexMoveSelectionToFileIntention.kt b/src/nl/hannahsten/texifyidea/intentions/LatexMoveSelectionToFileIntention.kt index 893cfa571..0e33b31b5 100644 --- a/src/nl/hannahsten/texifyidea/intentions/LatexMoveSelectionToFileIntention.kt +++ b/src/nl/hannahsten/texifyidea/intentions/LatexMoveSelectionToFileIntention.kt @@ -20,7 +20,7 @@ open class LatexMoveSelectionToFileIntention : TexifyIntentionBase("Move selecti companion object { - private const val minimumSelectionLength = 24 + private const val MINIMUM_SELECTION_LENGTH = 24 } override fun startInWriteAction() = false @@ -31,7 +31,7 @@ open class LatexMoveSelectionToFileIntention : TexifyIntentionBase("Move selecti } val selectionSize = selectionOffsets(editor).sumOf { (start, end): Pair -> end - start } - return selectionSize >= minimumSelectionLength + return selectionSize >= MINIMUM_SELECTION_LENGTH } override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { diff --git a/src/nl/hannahsten/texifyidea/lang/alias/CommandManager.kt b/src/nl/hannahsten/texifyidea/lang/alias/CommandManager.kt index 071a01c02..c40c19b17 100644 --- a/src/nl/hannahsten/texifyidea/lang/alias/CommandManager.kt +++ b/src/nl/hannahsten/texifyidea/lang/alias/CommandManager.kt @@ -2,9 +2,9 @@ package nl.hannahsten.texifyidea.lang.alias import nl.hannahsten.texifyidea.lang.LabelingCommandInformation import nl.hannahsten.texifyidea.psi.LatexCommands -import nl.hannahsten.texifyidea.util.parser.childrenOfType import nl.hannahsten.texifyidea.util.containsAny import nl.hannahsten.texifyidea.util.magic.CommandMagic +import nl.hannahsten.texifyidea.util.parser.childrenOfType import nl.hannahsten.texifyidea.util.parser.requiredParameter import nl.hannahsten.texifyidea.util.parser.requiredParameters import java.io.Serializable @@ -35,6 +35,7 @@ import kotlin.collections.set */ // Currently it is a singleton, in the future this may be one instance per fileset object CommandManager : Iterable, Serializable, AliasManager() { + private fun readResolve(): Any = CommandManager /** * Maps an original command to the set of current aliases. diff --git a/src/nl/hannahsten/texifyidea/modules/DefaultFileCreator.kt b/src/nl/hannahsten/texifyidea/modules/DefaultFileCreator.kt index 036a3a4df..c13cb8ce2 100644 --- a/src/nl/hannahsten/texifyidea/modules/DefaultFileCreator.kt +++ b/src/nl/hannahsten/texifyidea/modules/DefaultFileCreator.kt @@ -36,10 +36,10 @@ class DefaultFileCreator( // Apply template. val template = if (isBibtexEnabled) { - LatexTemplatesFactory.fileTemplateTexWithBib + LatexTemplatesFactory.FILE_TEMPLATE_TEX_WITH_BIB } else { - LatexTemplatesFactory.fileTemplateTex + LatexTemplatesFactory.FILE_TEMPLATE_TEX } val templateText = LatexTemplatesFactory.getTemplateText(project, template, fileName) @@ -69,7 +69,7 @@ class DefaultFileCreator( } // Apply template. - val template = LatexTemplatesFactory.fileTemplateBib + val template = LatexTemplatesFactory.FILE_TEMPLATE_BIB val templateText = LatexTemplatesFactory.getTemplateText(project, template, fileName) try { diff --git a/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyAuthenticator.kt b/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyAuthenticator.kt index 9910998ba..431b537e5 100644 --- a/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyAuthenticator.kt +++ b/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyAuthenticator.kt @@ -39,19 +39,19 @@ object MendeleyAuthenticator { /** * The port is fixed by Mendeley, so we choose a port that hopefully no one has anything running on. */ - private const val port = 59473 + private const val PORT = 59473 - private const val redirectPath = "/" + private const val REDIRECT_PATH = "/" - private const val redirectUrl = "http://localhost:$port$redirectPath" + private const val REDIRECT_URL = "http://localhost:$PORT$REDIRECT_PATH" /** * See [Mendeley documentation](https://dev.mendeley.com/reference/topics/authorization_auth_code.html) for explanations * about these parameters. */ private val authorizationParameters: String = Parameters.build { - append("client_id", MendeleyCredentials.id) - append("redirect_uri", redirectUrl) + append("client_id", MendeleyCredentials.ID) + append("redirect_uri", REDIRECT_URL) append("response_type", "code") append("scope", "all") }.formUrlEncode() @@ -80,7 +80,7 @@ object MendeleyAuthenticator { private fun createAuthenticationServer() { try { isUserAuthenticationFinished = false - authenticationServer = embeddedServer(Jetty, port = port) { + authenticationServer = embeddedServer(Jetty, port = PORT) { routing { get("/") { this.call.respondText("You are now logged in to Mendeley. Click OK to continue.") @@ -124,10 +124,10 @@ object MendeleyAuthenticator { formParameters = Parameters.build { append("grant_type", "authorization_code") append("code", it) - append("redirect_uri", redirectUrl) + append("redirect_uri", REDIRECT_URL) } ) { - basicAuth(MendeleyCredentials.id, MendeleyCredentials.secret.decipher()) + basicAuth(MendeleyCredentials.ID, MendeleyCredentials.SECRET.decipher()) }.body() token.getCredentials().first @@ -144,10 +144,10 @@ object MendeleyAuthenticator { formParameters = Parameters.build { append("grant_type", "refresh_token") append("refresh_token", refreshToken) - append("redirect_uri", "http://localhost:$port/") + append("redirect_uri", "http://localhost:$PORT/") } ) { - basicAuth(MendeleyCredentials.id, MendeleyCredentials.secret.decipher()) + basicAuth(MendeleyCredentials.ID, MendeleyCredentials.SECRET.decipher()) }.body() val (tokenCredentials, refreshTokenCredentials) = token.getCredentials() diff --git a/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyCredentials.kt b/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyCredentials.kt index d0a53e37d..4a7b6f3c9 100644 --- a/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyCredentials.kt +++ b/src/nl/hannahsten/texifyidea/remotelibraries/mendeley/MendeleyCredentials.kt @@ -5,10 +5,10 @@ object MendeleyCredentials { /** * TeXiFy id to communicate with Mendeley. */ - const val id = "13334" + const val ID = "13334" /** * TeXiFy secret to communicate with Mendeley. */ - const val secret = "xBa\u0083o\u0082VvmSx`qes?" + const val SECRET = "xBa\u0083o\u0082VvmSx`qes?" } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/run/latex/LatexConfigurationFactory.kt b/src/nl/hannahsten/texifyidea/run/latex/LatexConfigurationFactory.kt index b966e70c2..90087da09 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/LatexConfigurationFactory.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/LatexConfigurationFactory.kt @@ -17,7 +17,7 @@ class LatexConfigurationFactory(type: ConfigurationType) : ConfigurationFactory( companion object { - private const val factoryName = "LaTeX configuration factory" + private const val FACTORY_NAME = "LaTeX configuration factory" } override fun createTemplateConfiguration(project: Project) = when (type) { @@ -34,7 +34,7 @@ class LatexConfigurationFactory(type: ConfigurationType) : ConfigurationFactory( else -> throw IllegalArgumentException("No TeXiFy run configuration type, but ${type.id} was received instead.") } - override fun getName() = factoryName + override fun getName() = FACTORY_NAME - override fun getId() = factoryName + override fun getId() = FACTORY_NAME } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/run/latex/LatexOutputPath.kt b/src/nl/hannahsten/texifyidea/run/latex/LatexOutputPath.kt index b81276b1b..7cb5f6b17 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/LatexOutputPath.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/LatexOutputPath.kt @@ -26,8 +26,8 @@ class LatexOutputPath(private val variant: String, var contentRoot: VirtualFile? companion object { - const val projectDirString = "{projectDir}" - const val mainFileString = "{mainFileParent}" + const val PROJECT_DIR_STRING = "{projectDir}" + const val MAIN_FILE_STRING = "{mainFileParent}" } fun clone(): LatexOutputPath { @@ -37,7 +37,7 @@ class LatexOutputPath(private val variant: String, var contentRoot: VirtualFile? // Acts as a sort of cache var virtualFile: VirtualFile? = null - var pathString: String = "$projectDirString/$variant" + var pathString: String = "$PROJECT_DIR_STRING/$variant" /** * Get the output path based on the values of [virtualFile] and [pathString], create it if it does not exist. @@ -50,7 +50,7 @@ class LatexOutputPath(private val variant: String, var contentRoot: VirtualFile? // Just to be sure, avoid using jetbrains /bin path as output if (pathString.isBlank()) { - pathString = "$projectDirString/$variant" + pathString = "$PROJECT_DIR_STRING/$variant" } // Caching of the result @@ -69,13 +69,13 @@ class LatexOutputPath(private val variant: String, var contentRoot: VirtualFile? return virtualFile!! } else { - val pathString = if (pathString.contains(projectDirString)) { + val pathString = if (pathString.contains(PROJECT_DIR_STRING)) { if (contentRoot == null) return if (mainFile != null) mainFile?.parent else null - pathString.replace(projectDirString, contentRoot?.path ?: return null) + pathString.replace(PROJECT_DIR_STRING, contentRoot?.path ?: return null) } else { if (mainFile == null) return null - pathString.replace(mainFileString, mainFile?.parent?.path ?: return null) + pathString.replace(MAIN_FILE_STRING, mainFile?.parent?.path ?: return null) } val path = LocalFileSystem.getInstance().findFileByPath(pathString) if (path != null && path.isDirectory) { diff --git a/src/nl/hannahsten/texifyidea/run/latex/ui/LatexSettingsEditor.kt b/src/nl/hannahsten/texifyidea/run/latex/ui/LatexSettingsEditor.kt index 2f1a879bb..0fd861e7a 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/ui/LatexSettingsEditor.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/ui/LatexSettingsEditor.kt @@ -345,7 +345,7 @@ class LatexSettingsEditor(private var project: Project?) : SettingsEditor { companion object { diff --git a/src/nl/hannahsten/texifyidea/settings/sdk/LatexSdkUtil.kt b/src/nl/hannahsten/texifyidea/settings/sdk/LatexSdkUtil.kt index 816459e4e..39f0ff2f2 100644 --- a/src/nl/hannahsten/texifyidea/settings/sdk/LatexSdkUtil.kt +++ b/src/nl/hannahsten/texifyidea/settings/sdk/LatexSdkUtil.kt @@ -68,7 +68,6 @@ object LatexSdkUtil { private fun defaultIsDockerMiktex() = (!isMiktexAvailable && !TexliveSdk.isAvailable && DockerSdk.isAvailable) - @Suppress("RedundantIf") fun isAvailable(type: LatexDistributionType, project: Project): Boolean { if (type == LatexDistributionType.PROJECT_SDK && getLatexProjectSdk(project) != null) return true if (type == LatexDistributionType.MIKTEX && isMiktexAvailable) return true diff --git a/src/nl/hannahsten/texifyidea/templates/LatexTemplatesFactory.kt b/src/nl/hannahsten/texifyidea/templates/LatexTemplatesFactory.kt index a1650ecb5..5a81dfcf0 100644 --- a/src/nl/hannahsten/texifyidea/templates/LatexTemplatesFactory.kt +++ b/src/nl/hannahsten/texifyidea/templates/LatexTemplatesFactory.kt @@ -23,13 +23,13 @@ open class LatexTemplatesFactory : FileTemplateGroupDescriptorFactory { companion object { - const val descriptor = "LaTeX" - const val fileTemplateTex = "LaTeX Source.tex" - const val fileTemplateTexWithBib = "LaTeX Source With BibTeX.tex" - const val fileTemplateSty = "LaTeX Package.sty" - const val fileTemplateCls = "LaTeX Document class.cls" - const val fileTemplateBib = "BibTeX Bibliography.bib" - const val fileTemplateTikz = "TikZ Picture.tikz" + const val DESCRIPTOR = "LaTeX" + const val FILE_TEMPLATE_TEX = "LaTeX Source.tex" + const val FILE_TEMPLATE_TEX_WITH_BIB = "LaTeX Source With BibTeX.tex" + const val FILE_TEMPLATE_STY = "LaTeX Package.sty" + const val FILE_TEMPLATE_CLS = "LaTeX Document class.cls" + const val FILE_TEMPLATE_BIB = "BibTeX Bibliography.bib" + const val FILE_TEMPLATE_TIKZ = "TikZ Picture.tikz" @JvmStatic fun createFromTemplate( @@ -77,16 +77,16 @@ open class LatexTemplatesFactory : FileTemplateGroupDescriptorFactory { override fun getFileTemplatesDescriptor(): FileTemplateGroupDescriptor { val descriptor = FileTemplateGroupDescriptor( - descriptor, + DESCRIPTOR, TexifyIcons.LATEX_FILE ) - descriptor.addTemplate(FileTemplateDescriptor(fileTemplateTex, TexifyIcons.LATEX_FILE)) - descriptor.addTemplate(FileTemplateDescriptor(fileTemplateTexWithBib, TexifyIcons.LATEX_FILE)) - descriptor.addTemplate(FileTemplateDescriptor(fileTemplateSty, TexifyIcons.STYLE_FILE)) - descriptor.addTemplate(FileTemplateDescriptor(fileTemplateCls, TexifyIcons.CLASS_FILE)) - descriptor.addTemplate(FileTemplateDescriptor(fileTemplateBib, TexifyIcons.BIBLIOGRAPHY_FILE)) - descriptor.addTemplate(FileTemplateDescriptor(fileTemplateTikz, TexifyIcons.TIKZ_FILE)) + descriptor.addTemplate(FileTemplateDescriptor(FILE_TEMPLATE_TEX, TexifyIcons.LATEX_FILE)) + descriptor.addTemplate(FileTemplateDescriptor(FILE_TEMPLATE_TEX_WITH_BIB, TexifyIcons.LATEX_FILE)) + descriptor.addTemplate(FileTemplateDescriptor(FILE_TEMPLATE_STY, TexifyIcons.STYLE_FILE)) + descriptor.addTemplate(FileTemplateDescriptor(FILE_TEMPLATE_CLS, TexifyIcons.CLASS_FILE)) + descriptor.addTemplate(FileTemplateDescriptor(FILE_TEMPLATE_BIB, TexifyIcons.BIBLIOGRAPHY_FILE)) + descriptor.addTemplate(FileTemplateDescriptor(FILE_TEMPLATE_TIKZ, TexifyIcons.TIKZ_FILE)) return descriptor } diff --git a/src/nl/hannahsten/texifyidea/ui/ImagePanel.kt b/src/nl/hannahsten/texifyidea/ui/ImagePanel.kt index b88bb4034..901f06775 100644 --- a/src/nl/hannahsten/texifyidea/ui/ImagePanel.kt +++ b/src/nl/hannahsten/texifyidea/ui/ImagePanel.kt @@ -15,7 +15,7 @@ internal class ImagePanel : JPanel() { companion object { - private const val serialVersionUID = 1L + private const val SERIAL_VERSION_UID = 1L } private var image: Image? = null diff --git a/src/nl/hannahsten/texifyidea/util/Log.kt b/src/nl/hannahsten/texifyidea/util/Log.kt index 259bed783..fffa9bb2b 100644 --- a/src/nl/hannahsten/texifyidea/util/Log.kt +++ b/src/nl/hannahsten/texifyidea/util/Log.kt @@ -14,18 +14,18 @@ object Log { private val logger: Logger by lazy { Logger.getInstance(Log::class.java) } - private const val prefix = "TEXIFY-IDEA -" + private const val PREFIX = "TEXIFY-IDEA -" /** * Sends an info message to the IntelliJ logger. * * All messages start with the prefix `TEXIFY-IDEA - `. */ - fun info(message: String) = logger.info("$prefix $message") + fun info(message: String) = logger.info("$PREFIX $message") - fun warn(message: String) = logger.warn("$prefix $message") + fun warn(message: String) = logger.warn("$PREFIX $message") - fun debug(message: String) = logger.debug("$prefix $message") + fun debug(message: String) = logger.debug("$PREFIX $message") - fun error(message: String) = logger.error("$prefix $message") + fun error(message: String) = logger.error("$PREFIX $message") } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/util/magic/PatternMagic.kt b/src/nl/hannahsten/texifyidea/util/magic/PatternMagic.kt index a6b2de624..5b2d28d11 100644 --- a/src/nl/hannahsten/texifyidea/util/magic/PatternMagic.kt +++ b/src/nl/hannahsten/texifyidea/util/magic/PatternMagic.kt @@ -28,8 +28,8 @@ object PatternMagic { * Includes `[^.][^.]` because of abbreviations (at least in Dutch) like `s.v.p.` * An English semicolon is not a sentence end, but a greek question mark is. */ - const val sentenceEndPrefix = "[^.A-Z][^.A-Z]" - val sentenceEnd = RegexPattern.compile("($sentenceEndPrefix[.?!;] +[^%\\s])|(^\\. )")!! + const val SENTENCE_END_PREFIX = "[^.A-Z][^.A-Z]" + val sentenceEnd = RegexPattern.compile("($SENTENCE_END_PREFIX[.?!;] +[^%\\s])|(^\\. )")!! /** * Matches all interpunction that marks the end of a sentence. diff --git a/test/nl/hannahsten/texifyidea/run/LatexRunConfigurationTest.kt b/test/nl/hannahsten/texifyidea/run/LatexRunConfigurationTest.kt index b24d29ba0..bdbbd4e12 100644 --- a/test/nl/hannahsten/texifyidea/run/LatexRunConfigurationTest.kt +++ b/test/nl/hannahsten/texifyidea/run/LatexRunConfigurationTest.kt @@ -15,12 +15,12 @@ class LatexRunConfigurationTest : BasePlatformTestCase() { val runConfig = LatexRunConfiguration(myFixture.project, LatexRunConfigurationProducer().configurationFactory, "Test run config") val element = Element("configuration", Namespace.getNamespace("", "")) runConfig.compiler = LatexCompiler.LATEXMK - runConfig.outputPath.pathString = LatexOutputPath.projectDirString + "otherout" + runConfig.outputPath.pathString = LatexOutputPath.PROJECT_DIR_STRING + "otherout" runConfig.writeExternal(element) runConfig.readExternal(element) // Not sure if this actually tests anything assertEquals(runConfig.compiler, LatexCompiler.LATEXMK) - assertEquals(runConfig.outputPath.pathString, LatexOutputPath.projectDirString + "otherout") + assertEquals(runConfig.outputPath.pathString, LatexOutputPath.PROJECT_DIR_STRING + "otherout") } fun testBibRunConfig() {