Skip to content

Commit 7af2617

Browse files
authored
Merge pull request #67 from codacy/remove-overriddenName-from-language
Remove overridden name from language
2 parents 21869b0 + ea77f48 commit 7af2617

File tree

7 files changed

+37
-53
lines changed

7 files changed

+37
-53
lines changed

.circleci/config.yml

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,31 @@
11
version: 2.1
22

33
orbs:
4-
codacy: codacy/base@1.0.0
4+
codacy: codacy/base@10.0.2
55

66
workflows:
77
version: 2
88
compile_test_deploy:
99
jobs:
1010
- codacy/checkout_and_version:
1111
write_sbt_version: true
12-
- codacy/sbt:
13-
name: populate_cache
14-
cmd: sbt "set scalafmtUseIvy in ThisBuild := false;update"
15-
persist_to_workspace: true
16-
requires:
17-
- codacy/checkout_and_version
18-
- codacy/sbt:
19-
name: check_fmt
20-
cmd: sbt "scalafmt::test;test:scalafmt::test;sbt:scalafmt::test"
21-
requires:
22-
- populate_cache
23-
- codacy/sbt:
24-
name: compile
25-
cmd: |
26-
sbt +compile
27-
sbt +test:compile
28-
requires:
29-
- check_fmt
30-
- codacy/sbt:
12+
- codacy/sbt_docker:
3113
name: test
32-
cmd: |
33-
sbt "coverage;coverageReport;coverageAggregate"
34-
sbt +test
35-
36-
if [ -z "$CODACY_PROJECT_TOKEN" ]; then
37-
echo "CODACY_PROJECT_TOKEN not found. Skipping send coverage to Codacy."
38-
else
39-
sbt codacyCoverage
40-
fi
14+
steps:
15+
- run:
16+
name: Scalafmt sources
17+
command: sbt scalafmtCheckAll
18+
- run:
19+
name: Scalafmt sbt sources
20+
command: sbt scalafmtSbtCheck
21+
- run:
22+
name: Compile
23+
command: sbt +compile
24+
- run:
25+
name: Test
26+
command: sbt +test
4127
requires:
42-
- compile
28+
- codacy/checkout_and_version
4329
- codacy/sbt:
4430
name: publish
4531
cmd: |

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
val scala211 = "2.11.12"
22
val scala212 = "2.12.10"
3-
val scala213 = "2.13.1"
3+
val scala213 = "2.13.10"
44

55
name := "codacy-plugins-api"
66
organization := "com.codacy"
@@ -9,7 +9,7 @@ scalaVersion := scala212
99

1010
crossScalaVersions := Seq(scala211, scala212, scala213)
1111

12-
libraryDependencies ++= Seq("org.specs2" %% "specs2-core" % "4.8.3" % Test)
12+
libraryDependencies ++= Seq("wordspec", "shouldmatchers").map(m => "org.scalatest" %% s"scalatest-$m" % "3.2.14" % Test)
1313

1414
unmanagedSourceDirectories in Compile += {
1515
val sourceDir = (sourceDirectory in Compile).value

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.3.6
1+
sbt.version=1.8.0

project/plugins.sbt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
resolvers += Resolver.jcenterRepo
2-
3-
addSbtPlugin("com.codacy" % "codacy-sbt-plugin" % "17.1.5")
1+
addSbtPlugin("com.codacy" % "codacy-sbt-plugin" % "24.0.0")

src/main/scala/com/codacy/plugins/api/languages/Language.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.codacy.plugins.api.languages
22

3-
sealed abstract class Language(val extensions: Set[String],
4-
val overriddenName: Option[String] = Option.empty[String],
5-
val files: Set[String] = Set.empty[String]) {
3+
sealed abstract class Language(val extensions: Set[String], val files: Set[String] = Set.empty[String]) {
64
self: Product =>
7-
val name: String = overriddenName.getOrElse(self.productPrefix)
5+
val name: String = self.productPrefix
86

97
override def toString: String = name
108
}
@@ -80,7 +78,7 @@ object Languages {
8078
Perl,
8179
CSharp,
8280
VisualBasic,
83-
ObjectiveC,
81+
`Objective C`,
8482
FSharp,
8583
Cobol,
8684
Fortran,
@@ -225,7 +223,7 @@ object Languages {
225223
case object VisualBasic extends Language(extensions = Set(".vb"))
226224

227225
// Support startdate: November 2020
228-
case object ObjectiveC extends Language(overriddenName = Some("Objective C"), extensions = Set(".m"))
226+
case object `Objective C` extends Language(extensions = Set(".m"))
229227

230228
// Support startdate: March 2021
231229
case object YAML extends Language(extensions = Set(".yaml", ".yml"))

src/main/scala/com/codacy/plugins/api/results/Pattern.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ object Pattern {
4141
type Category = Category.Value
4242
object Category extends Enumeration {
4343
val Security, CodeStyle, ErrorProne, Performance, Compatibility, UnusedCode, Complexity, BestPractice,
44-
Comprehensibility, Duplication, Documentation = Value
44+
Comprehensibility, Duplication, Documentation = Value
4545
}
4646

4747
type Subcategory = Subcategory.Value
4848
object Subcategory extends Enumeration {
4949
val XSS, InputValidation, FileAccess, HTTP, Cookies, UnexpectedBehaviour, MassAssignment, InsecureStorage,
50-
InsecureModulesLibraries, Visibility, CSRF, Android, MaliciousCode, Cryptography, CommandInjection, FirefoxOS, Auth,
51-
DoS, SQLInjection, Routes, Regex, SSL, Other = Value
50+
InsecureModulesLibraries, Visibility, CSRF, Android, MaliciousCode, Cryptography, CommandInjection, FirefoxOS,
51+
Auth, DoS, SQLInjection, Routes, Regex, SSL, Other = Value
5252
}
5353
}

src/test/scala/com.codacy.plugins.api.languages/LanguageSpec.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.codacy.plugins.api.languages
22

3-
import org.specs2.control.NoLanguageFeatures
4-
import org.specs2.mutable.Specification
3+
import org.scalatest.matchers.should.Matchers
4+
import org.scalatest.OptionValues
5+
import org.scalatest.wordspec.AnyWordSpec
56

6-
class LanguageSpec extends Specification with NoLanguageFeatures {
7+
class LanguageSpec extends AnyWordSpec with Matchers with OptionValues {
78
"Languages" should {
89
"filter by language" in {
910
val expected = Seq("src/main/scala/com/codacy/File1.scala",
@@ -21,14 +22,15 @@ class LanguageSpec extends Specification with NoLanguageFeatures {
2122
Map((Languages.Scala, Set(".sc"))))
2223
.toList
2324

24-
files should containTheSameElementsAs(expected)
25+
files should contain theSameElementsAs expected
2526
}
2627

2728
"forPath" in {
28-
Languages.forPath("src/main/scala/com/codacy/File1.scala") should beEqualTo(Some(Languages.Scala))
29-
Languages.forPath("src/main/scala/com/codacy/File1.sc", List((Languages.Scala, Seq(".sc")))) should beEqualTo(
30-
Some(Languages.Scala))
31-
Languages.forPath("src/File3.mjs") should beEqualTo(Some(Languages.Javascript))
29+
Languages.forPath("src/main/scala/com/codacy/File1.scala").value shouldBe Languages.Scala
30+
Languages
31+
.forPath("src/main/scala/com/codacy/File1.sc", List((Languages.Scala, Seq(".sc"))))
32+
.value shouldBe Languages.Scala
33+
Languages.forPath("src/File3.mjs").value shouldBe Languages.Javascript
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)