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

codebase improvements #23

Open
derrickoswald opened this issue Apr 15, 2020 · 0 comments
Open

codebase improvements #23

derrickoswald opened this issue Apr 15, 2020 · 0 comments

Comments

@derrickoswald
Copy link
Owner

derrickoswald commented Apr 15, 2020

The wart remover (http://www.wartremover.org/) and scalastyle (http://www.scalastyle.org/) show a number of places where the codebase could be improved.

Some of the wart remover rules are stupid, like not allowing default method parameters - which is one of the best features of Scala, but it is what it is.

This issue tracks the changes that are needed to bring the codebase into compliance with a subset of the wart remover and scalastyle checks.

To work on this issue, in the CIMSpark pom.xml, add the wartremover compiler plugin to the net.alchim31.maven:scala-maven-plugin within the configuration, add wartremover options to the scala compiler args and comment out the fatal warnings flag:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>${version.dependency.scala-maven-plugin}</version>
    <configuration>
        <scalaCompatVersion>${version.dependency.scala}</scalaCompatVersion>
        <scalaVersion>${version.dependency.scalalibrary}</scalaVersion>
        <archive>
            <addMavenDescriptor>false</addMavenDescriptor>
        </archive>
        <compilerPlugins>
            <compilerPlugin>
                <groupId>org.wartremover</groupId>
                <artifactId>wartremover_${version.dependency.scalalibrary}</artifactId>
                <version>${version.dependency.wartremover}</version>
            </compilerPlugin>
        </compilerPlugins>
        <displayCmd>true</displayCmd>
        <args>
            <arg>-deprecation</arg>
            <arg>-feature</arg>
            <arg>-unchecked</arg>
            <arg>-Ywarn-dead-code</arg>
            <arg>-Ywarn-unused</arg>
            <!-- arg>-Xfatal-warnings</arg -->
            <arg>-Xlint:_</arg>
            <arg>-target:jvm-1.8</arg>
            <!-- see https://github.com/wartremover/wartremover/blob/704113034f9d2829aa8d577ac4f059c2136c6781/core/src/main/scala/wartremover/warts/Unsafe.scala -->
            <!-- arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Any</arg -->
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.AsInstanceOf</arg>
            <!-- arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.DefaultArguments</arg -->
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.EitherProjectionPartial</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.IsInstanceOf</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.NonUnitStatements</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Null</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.OptionPartial</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Product</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Return</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Serializable</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.StringPlusAny</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Throw</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.TraversableOps</arg>
            <arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.TryPartial</arg>
        </args>
    </configuration>
...

Recompile some module and then work on resolving the WARNINGs.

derrickoswald pushed a commit that referenced this issue May 12, 2020
derrickoswald pushed a commit that referenced this issue May 18, 2020
derrickoswald pushed a commit that referenced this issue May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant