From 79dc669e360edf3c89a7f9c69d930836b0056f02 Mon Sep 17 00:00:00 2001 From: Hersh Amin Date: Mon, 4 Jun 2018 23:03:48 -0500 Subject: [PATCH 1/6] [wip] Added kotlin duplication checks --- lib/cc/engine/analyzers/kotlin/main.rb | 40 ++++ lib/cc/engine/duplication.rb | 2 + .../cc/engine/analyzers/engine_config_spec.rb | 1 + .../cc/engine/analyzers/kotlin/kotlin_spec.rb | 218 ++++++++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 lib/cc/engine/analyzers/kotlin/main.rb create mode 100644 spec/cc/engine/analyzers/kotlin/kotlin_spec.rb diff --git a/lib/cc/engine/analyzers/kotlin/main.rb b/lib/cc/engine/analyzers/kotlin/main.rb new file mode 100644 index 00000000..159cd091 --- /dev/null +++ b/lib/cc/engine/analyzers/kotlin/main.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require "flay" +require "json" +require "cc/engine/analyzers/reporter" +require "cc/engine/analyzers/analyzer_base" + +module CC + module Engine + module Analyzers + module Kotlin + class Main < CC::Engine::Analyzers::Base + LANGUAGE = "kotlin".freeze + PATTERNS = ["**/*.kt"].freeze + DEFAULT_MASS_THRESHOLD = 40 + DEFAULT_FILTERS = [ + "(IMPORT_LIST ___)".freeze, + "(PACKAGE_DIRECTIVE ___)".freeze, + ].freeze + POINTS_PER_OVERAGE = 10_000 + REQUEST_PATH = "/kotlin".freeze + + def use_sexp_lines? + false + end + + private + + def process_file(file) + parse(file, REQUEST_PATH) + end + + def default_filters + DEFAULT_FILTERS.map { |filter| Sexp::Matcher.parse filter } + end + end + end + end + end +end diff --git a/lib/cc/engine/duplication.rb b/lib/cc/engine/duplication.rb index 43120ec5..0487e1ad 100644 --- a/lib/cc/engine/duplication.rb +++ b/lib/cc/engine/duplication.rb @@ -4,6 +4,7 @@ require "cc/engine/parse_metrics" require "cc/engine/analyzers/ruby/main" require "cc/engine/analyzers/java/main" +require "cc/engine/analyzers/kotlin/main" require "cc/engine/analyzers/javascript/main" require "cc/engine/analyzers/go/main" require "cc/engine/analyzers/php/main" @@ -22,6 +23,7 @@ class Duplication LANGUAGES = { "ruby" => ::CC::Engine::Analyzers::Ruby::Main, "java" => ::CC::Engine::Analyzers::Java::Main, + "kotlin" => ::CC::Engine::Analyzers::Kotlin::Main, "javascript" => ::CC::Engine::Analyzers::Javascript::Main, "php" => ::CC::Engine::Analyzers::Php::Main, "python" => ::CC::Engine::Analyzers::Python::Main, diff --git a/spec/cc/engine/analyzers/engine_config_spec.rb b/spec/cc/engine/analyzers/engine_config_spec.rb index fd5c959d..ce0072d1 100644 --- a/spec/cc/engine/analyzers/engine_config_spec.rb +++ b/spec/cc/engine/analyzers/engine_config_spec.rb @@ -45,6 +45,7 @@ expect(engine_config.languages).to eq({ "ruby" => {}, "java" => {}, + "kotlin" => {}, "javascript" => {}, "php" => {}, "python" => {}, diff --git a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb new file mode 100644 index 00000000..ee88a259 --- /dev/null +++ b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb @@ -0,0 +1,218 @@ +=begin +require "spec_helper" +require "cc/engine/analyzers/java/main" +require "cc/engine/analyzers/engine_config" + +module CC::Engine::Analyzers + RSpec.describe Java::Main, in_tmpdir: true do + include AnalyzerSpecHelpers + + describe "#run" do + let(:engine_conf) { EngineConfig.new({}) } + + it "prints an issue for similar code" do + create_source_file("foo.java", <<-EOF) + public class ArrayDemo { + public static void foo() { + int[] anArray; + + anArray = new int[10]; + + for (int i = 0; i < anArray.length; i++) { + anArray[i] = i; + } + + for (int i = 0; i < anArray.length; i++) { + System.out.print(anArray[i] + " "); + } + + System.out.println(); + } + + public static void bar() { + int[] anArray; + + anArray = new int[10]; + + for (int i = 0; i < anArray.length; i++) { + anArray[i] = i; + } + + for (int i = 0; i < anArray.length; i++) { + System.out.print(anArray[i] + " "); + } + + System.out.println(); + } + } + EOF + + issues = run_engine(engine_conf).strip.split("\0") + result = issues.first.strip + json = JSON.parse(result) + + expect(json["type"]).to eq("issue") + expect(json["check_name"]).to eq("similar-code") + expect(json["description"]).to eq("Similar blocks of code found in 2 locations. Consider refactoring.") + expect(json["categories"]).to eq(["Duplication"]) + expect(json["location"]).to eq({ + "path" => "foo.java", + "lines" => { "begin" => 2, "end" => 16 }, + }) + expect(json["remediation_points"]).to eq(930_000) + expect(json["other_locations"]).to eq([ + {"path" => "foo.java", "lines" => { "begin" => 18, "end" => 32 } }, + ]) + expect(json["content"]["body"]).to match /This issue has a mass of 103/ + expect(json["fingerprint"]).to eq("48eb151dc29634f90a86ffabf9d3c4b5") + expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR) + end + + it "prints an issue for identical code" do + create_source_file("foo.java", <<-EOF) + public class ArrayDemo { + public static void foo(int[] anArray) { + for (int i = 0; i < anArray.length; i++) { + System.out.print(anArray[i] + " "); + } + + System.out.println(); + } + + public static void foo(int[] anArray) { + for (int i = 0; i < anArray.length; i++) { + System.out.print(anArray[i] + " "); + } + + System.out.println(); + } + } + EOF + + issues = run_engine(engine_conf).strip.split("\0") + result = issues.first.strip + json = JSON.parse(result) + + expect(json["type"]).to eq("issue") + expect(json["check_name"]).to eq("identical-code") + expect(json["description"]).to eq("Identical blocks of code found in 2 locations. Consider refactoring.") + expect(json["categories"]).to eq(["Duplication"]) + expect(json["location"]).to eq({ + "path" => "foo.java", + "lines" => { "begin" => 2, "end" => 8 }, + }) + expect(json["remediation_points"]).to eq(420_000) + expect(json["other_locations"]).to eq([ + {"path" => "foo.java", "lines" => { "begin" => 10, "end" => 16 } }, + ]) + expect(json["content"]["body"]).to match /This issue has a mass of 52/ + expect(json["fingerprint"]).to eq("dbb957b34f7b5312538235c0aa3f52a0") + expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MINOR) + end + + it "outputs a warning for unprocessable errors" do + create_source_file("foo.java", <<-EOF) + --- + EOF + + expect(CC.logger).to receive(:warn).with(/Response status: 422/) + expect(CC.logger).to receive(:warn).with(/Skipping/) + run_engine(engine_conf) + end + + it "ignores import and package declarations" do + create_source_file("foo.java", <<-EOF) +package org.springframework.rules.constraint; + +import java.util.Comparator; + +import org.springframework.rules.constraint.Constraint; +import org.springframework.rules.closure.BinaryConstraint; + EOF + + create_source_file("bar.java", <<-EOF) +package org.springframework.rules.constraint; + +import java.util.Comparator; + +import org.springframework.rules.constraint.Constraint; +import org.springframework.rules.closure.BinaryConstraint; + EOF + + issues = run_engine(engine_conf).strip.split("\0") + expect(issues).to be_empty + end + + it "prints an issue for similar code when the only difference is the value of a literal" do + create_source_file("foo.java", <<-EOF) + public class ArrayDemo { + public static void foo() { + int[] scott; + scott = new int[] { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F + }; + + int[] anArray; + + anArray = new int[10]; + + for (int i = 0; i < anArray.length; i++) { + anArray[i] = i; + } + + for (int i = 0; i < anArray.length; i++) { + System.out.print(anArray[i] + " "); + } + + System.out.println(); + } + + public static void foo() { + int[] scott; + scott = new int[] { + 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7 + }; + + int[] anArray; + + anArray = new int[10]; + + for (int i = 0; i < anArray.length; i++) { + anArray[i] = i; + } + + for (int i = 0; i < anArray.length; i++) { + System.out.print(anArray[i] + " "); + } + + System.out.println(); + } + } + EOF + + issues = run_engine(engine_conf).strip.split("\0") + expect(issues.length).to be > 0 + result = issues.first.strip + json = JSON.parse(result) + + expect(json["type"]).to eq("issue") + expect(json["check_name"]).to eq("similar-code") + + expect(json["description"]).to eq("Similar blocks of code found in 2 locations. Consider refactoring.") + expect(json["categories"]).to eq(["Duplication"]) + expect(json["location"]).to eq({ + "path" => "foo.java", + "lines" => { "begin" => 2, "end" => 21 }, + }) + expect(json["remediation_points"]).to eq(1_230_000) + expect(json["other_locations"]).to eq([ + {"path" => "foo.java", "lines" => { "begin" => 23, "end" => 42 } }, + ]) + expect(json["content"]["body"]).to match /This issue has a mass of 133/ + expect(json["fingerprint"]).to eq("9abf88bac3a56bf708a5c4ceaf251d98") + expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR) + end + end + end +end +=end \ No newline at end of file From a62c8222b5d6c68f4cef4d1d645de539a19b4791 Mon Sep 17 00:00:00 2001 From: Hersh Amin Date: Tue, 5 Jun 2018 00:04:47 -0500 Subject: [PATCH 2/6] [wip] Added kotlin duplication checks (2) --- .../cc/engine/analyzers/kotlin/kotlin_spec.rb | 158 ++++++++---------- 1 file changed, 69 insertions(+), 89 deletions(-) diff --git a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb index ee88a259..3ac9d3f0 100644 --- a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb +++ b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb @@ -1,48 +1,43 @@ -=begin require "spec_helper" -require "cc/engine/analyzers/java/main" +require "cc/engine/analyzers/kotlin/main" require "cc/engine/analyzers/engine_config" module CC::Engine::Analyzers - RSpec.describe Java::Main, in_tmpdir: true do + RSpec.describe Kotlin::Main, in_tmpdir: true do include AnalyzerSpecHelpers describe "#run" do let(:engine_conf) { EngineConfig.new({}) } it "prints an issue for similar code" do - create_source_file("foo.java", <<-EOF) - public class ArrayDemo { - public static void foo() { - int[] anArray; + create_source_file("foo.kt", <<-EOF) + class ArrayDemo { + fun foo() { + val anArray: Array = Array(10) - anArray = new int[10]; - - for (int i = 0; i < anArray.length; i++) { - anArray[i] = i; + for (i in 0..10) { + anArray[i] = i } - for (int i = 0; i < anArray.length; i++) { - System.out.print(anArray[i] + " "); + for (i in 0..10) { + println(anArray[i]) } - System.out.println(); + println("") } - public static void bar() { - int[] anArray; - - anArray = new int[10]; + fun bar() { + val anArray: Array = Array(10) - for (int i = 0; i < anArray.length; i++) { - anArray[i] = i; + for (i in 0..10) { + anArray[i] = i } - for (int i = 0; i < anArray.length; i++) { - System.out.print(anArray[i] + " "); + for (i in 0..10) { + println(anArray[i]) } - System.out.println(); + println("") } } EOF @@ -56,35 +51,32 @@ module CC::Engine::Analyzers expect(json["description"]).to eq("Similar blocks of code found in 2 locations. Consider refactoring.") expect(json["categories"]).to eq(["Duplication"]) expect(json["location"]).to eq({ - "path" => "foo.java", - "lines" => { "begin" => 2, "end" => 16 }, + "path" => "foo.kt", + "lines" => { "begin" => 2, "end" => 14 }, }) - expect(json["remediation_points"]).to eq(930_000) expect(json["other_locations"]).to eq([ - {"path" => "foo.java", "lines" => { "begin" => 18, "end" => 32 } }, + {"path" => "foo.kt", "lines" => { "begin" => 16, "end" => 28 } }, ]) - expect(json["content"]["body"]).to match /This issue has a mass of 103/ - expect(json["fingerprint"]).to eq("48eb151dc29634f90a86ffabf9d3c4b5") expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR) end it "prints an issue for identical code" do - create_source_file("foo.java", <<-EOF) - public class ArrayDemo { - public static void foo(int[] anArray) { - for (int i = 0; i < anArray.length; i++) { - System.out.print(anArray[i] + " "); + create_source_file("foo.kt", <<-EOF) + class ArrayDemo { + fun foo(anArray: Array) { + for (i in anArray.indices) { + println(anArray[i] + " ") } - System.out.println(); + println("") } - public static void foo(int[] anArray) { - for (int i = 0; i < anArray.length; i++) { - System.out.print(anArray[i] + " "); + fun foo(anArray: Array) { + for (i in anArray.indices) { + println(anArray[i] + " ") } - System.out.println(); + println("") } } EOF @@ -98,20 +90,17 @@ module CC::Engine::Analyzers expect(json["description"]).to eq("Identical blocks of code found in 2 locations. Consider refactoring.") expect(json["categories"]).to eq(["Duplication"]) expect(json["location"]).to eq({ - "path" => "foo.java", + "path" => "foo.kt", "lines" => { "begin" => 2, "end" => 8 }, }) - expect(json["remediation_points"]).to eq(420_000) expect(json["other_locations"]).to eq([ - {"path" => "foo.java", "lines" => { "begin" => 10, "end" => 16 } }, + {"path" => "foo.kt", "lines" => { "begin" => 10, "end" => 16 } }, ]) - expect(json["content"]["body"]).to match /This issue has a mass of 52/ - expect(json["fingerprint"]).to eq("dbb957b34f7b5312538235c0aa3f52a0") - expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MINOR) + expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR) end it "outputs a warning for unprocessable errors" do - create_source_file("foo.java", <<-EOF) + create_source_file("foo.kt", <<-EOF) --- EOF @@ -121,22 +110,22 @@ module CC::Engine::Analyzers end it "ignores import and package declarations" do - create_source_file("foo.java", <<-EOF) -package org.springframework.rules.constraint; + create_source_file("foo.kt", <<-EOF) + package org.springframework.rules.constraint; -import java.util.Comparator; + import java.util.Comparator; -import org.springframework.rules.constraint.Constraint; -import org.springframework.rules.closure.BinaryConstraint; + import org.springframework.rules.constraint.Constraint; + import org.springframework.rules.closure.BinaryConstraint; EOF - create_source_file("bar.java", <<-EOF) -package org.springframework.rules.constraint; + create_source_file("bar.kt", <<-EOF) + package org.springframework.rules.constraint; -import java.util.Comparator; + import java.util.Comparator; -import org.springframework.rules.constraint.Constraint; -import org.springframework.rules.closure.BinaryConstraint; + import org.springframework.rules.constraint.Constraint; + import org.springframework.rules.closure.BinaryConstraint; EOF issues = run_engine(engine_conf).strip.split("\0") @@ -144,48 +133,42 @@ module CC::Engine::Analyzers end it "prints an issue for similar code when the only difference is the value of a literal" do - create_source_file("foo.java", <<-EOF) - public class ArrayDemo { - public static void foo() { - int[] scott; - scott = new int[] { + create_source_file("foo.kt", <<-EOF) + class ArrayDemo { + fun foo() { + val scott = arrayOfInt( 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F - }; + ) - int[] anArray; + val anArray: Array = Array(10) - anArray = new int[10]; - - for (int i = 0; i < anArray.length; i++) { - anArray[i] = i; + for (i in 0..<10) { + anArray[i] = i } - for (int i = 0; i < anArray.length; i++) { - System.out.print(anArray[i] + " "); + for (i in 0..<10) { + println(anArray[i] + " ") } - System.out.println(); + println() } - public static void foo() { - int[] scott; - scott = new int[] { + fun foo() { + val scott = arrayOfInt( 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7 - }; - - int[] anArray; + ) - anArray = new int[10]; + val anArray: Array = Array(10) - for (int i = 0; i < anArray.length; i++) { - anArray[i] = i; + for (i in 0..<10) { + anArray[i] = i } - for (int i = 0; i < anArray.length; i++) { - System.out.print(anArray[i] + " "); + for (i in 0..<10) { + println(anArray[i] + " ") } - System.out.println(); + println() } } EOF @@ -201,18 +184,15 @@ module CC::Engine::Analyzers expect(json["description"]).to eq("Similar blocks of code found in 2 locations. Consider refactoring.") expect(json["categories"]).to eq(["Duplication"]) expect(json["location"]).to eq({ - "path" => "foo.java", - "lines" => { "begin" => 2, "end" => 21 }, + "path" => "foo.kt", + "lines" => { "begin" => 2, "end" => 18 }, }) - expect(json["remediation_points"]).to eq(1_230_000) expect(json["other_locations"]).to eq([ - {"path" => "foo.java", "lines" => { "begin" => 23, "end" => 42 } }, + {"path" => "foo.kt", "lines" => { "begin" => 20, "end" => 36 } }, ]) - expect(json["content"]["body"]).to match /This issue has a mass of 133/ - expect(json["fingerprint"]).to eq("9abf88bac3a56bf708a5c4ceaf251d98") expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR) end + end end end -=end \ No newline at end of file From 6eb2eaea19f57561473d0953c91196178985c742 Mon Sep 17 00:00:00 2001 From: Hersh Amin Date: Tue, 5 Jun 2018 15:16:28 -0500 Subject: [PATCH 3/6] Added Kotlin duplication checks --- spec/cc/engine/analyzers/kotlin/kotlin_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb index 3ac9d3f0..696cc9ca 100644 --- a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb +++ b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb @@ -142,11 +142,11 @@ class ArrayDemo { val anArray: Array = Array(10) - for (i in 0..<10) { + for (i in 0..10) { anArray[i] = i } - for (i in 0..<10) { + for (i in 0..10) { println(anArray[i] + " ") } @@ -160,11 +160,11 @@ class ArrayDemo { val anArray: Array = Array(10) - for (i in 0..<10) { + for (i in 0..10) { anArray[i] = i } - for (i in 0..<10) { + for (i in 0..10) { println(anArray[i] + " ") } From e0cf35a34136247baf545e1aec6b504ddef7b823 Mon Sep 17 00:00:00 2001 From: Hersh Amin Date: Thu, 7 Jun 2018 10:31:56 -0500 Subject: [PATCH 4/6] Added comment doc and comments to ignore --- lib/cc/engine/analyzers/kotlin/main.rb | 2 + .../cc/engine/analyzers/kotlin/kotlin_spec.rb | 80 +++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/lib/cc/engine/analyzers/kotlin/main.rb b/lib/cc/engine/analyzers/kotlin/main.rb index 159cd091..76a6b4a3 100644 --- a/lib/cc/engine/analyzers/kotlin/main.rb +++ b/lib/cc/engine/analyzers/kotlin/main.rb @@ -16,6 +16,8 @@ class Main < CC::Engine::Analyzers::Base DEFAULT_FILTERS = [ "(IMPORT_LIST ___)".freeze, "(PACKAGE_DIRECTIVE ___)".freeze, + "(KDoc ___)".freeze, + "(EOL_COMMENT ___)".freeze, ].freeze POINTS_PER_OVERAGE = 10_000 REQUEST_PATH = "/kotlin".freeze diff --git a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb index 696cc9ca..7ec4fc44 100644 --- a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb +++ b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb @@ -193,6 +193,86 @@ class ArrayDemo { expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR) end + it "ignores comment docs and comments" do + create_source_file("foo.kt", <<-EOF) + /******************************************************************************* + * * + * Copyright (C) 2017 by Max Lv * + * Copyright (C) 2017 by Mygod Studio * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + + package com.github.shadowsocks.acl + // Comment here + + import org.junit.Assert + import org.junit.Test + + class AclTest { + // Comment here + companion object { + private const val INPUT1 = """[proxy_all] + [bypass_list] + 1.0.1.0/24 + (^|\.)4tern\.com${'$'} + """ + } + + @Test + fun parse() { + Assert.assertEquals(INPUT1, Acl().fromReader(INPUT1.reader()).toString()); + } + } + EOF + + create_source_file("bar.kt", <<-EOF) + /******************************************************************************* + * * + * Copyright (C) 2017 by Max Lv * + * Copyright (C) 2017 by Mygod Studio * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + + package com.evernote.android.job + // Comment here + + object JobConstants { + // Comment here + const val DATABASE_NAME = JobStorage.DATABASE_NAME + const val PREF_FILE_NAME = JobStorage.PREF_FILE_NAME + } + EOF + + issues = run_engine(engine_conf).strip.split("\0") + expect(issues).to be_empty + end + end end end From dda1a2203e73514d1abfe47972e280b9f6a6bcc0 Mon Sep 17 00:00:00 2001 From: Scott Larkin Date: Tue, 12 Jun 2018 16:43:34 -0400 Subject: [PATCH 5/6] Shorten the example comments to a few lines --- .../cc/engine/analyzers/kotlin/kotlin_spec.rb | 44 +++---------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb index 7ec4fc44..136d9732 100644 --- a/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb +++ b/spec/cc/engine/analyzers/kotlin/kotlin_spec.rb @@ -195,25 +195,9 @@ class ArrayDemo { it "ignores comment docs and comments" do create_source_file("foo.kt", <<-EOF) - /******************************************************************************* - * * - * Copyright (C) 2017 by Max Lv * - * Copyright (C) 2017 by Mygod Studio * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ + /******************************************************************** + * Copyright (C) 2017 by Max Lv + *******************************************************************/ package com.github.shadowsocks.acl // Comment here @@ -239,25 +223,9 @@ class AclTest { EOF create_source_file("bar.kt", <<-EOF) - /******************************************************************************* - * * - * Copyright (C) 2017 by Max Lv * - * Copyright (C) 2017 by Mygod Studio * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ + /********************************************************************* + * Copyright (C) 2017 by Max Lv + ********************************************************************/ package com.evernote.android.job // Comment here From 8841d1ea0466c53fea1110077bc52d5ccdadfa40 Mon Sep 17 00:00:00 2001 From: Scott Larkin Date: Tue, 12 Jun 2018 16:54:30 -0400 Subject: [PATCH 6/6] Sort alphabetically --- lib/cc/engine/duplication.rb | 2 +- spec/cc/engine/analyzers/engine_config_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cc/engine/duplication.rb b/lib/cc/engine/duplication.rb index 0487e1ad..76ef5161 100644 --- a/lib/cc/engine/duplication.rb +++ b/lib/cc/engine/duplication.rb @@ -23,8 +23,8 @@ class Duplication LANGUAGES = { "ruby" => ::CC::Engine::Analyzers::Ruby::Main, "java" => ::CC::Engine::Analyzers::Java::Main, - "kotlin" => ::CC::Engine::Analyzers::Kotlin::Main, "javascript" => ::CC::Engine::Analyzers::Javascript::Main, + "kotlin" => ::CC::Engine::Analyzers::Kotlin::Main, "php" => ::CC::Engine::Analyzers::Php::Main, "python" => ::CC::Engine::Analyzers::Python::Main, "typescript" => ::CC::Engine::Analyzers::TypeScript::Main, diff --git a/spec/cc/engine/analyzers/engine_config_spec.rb b/spec/cc/engine/analyzers/engine_config_spec.rb index ce0072d1..0a7ec6c9 100644 --- a/spec/cc/engine/analyzers/engine_config_spec.rb +++ b/spec/cc/engine/analyzers/engine_config_spec.rb @@ -45,8 +45,8 @@ expect(engine_config.languages).to eq({ "ruby" => {}, "java" => {}, - "kotlin" => {}, "javascript" => {}, + "kotlin" => {}, "php" => {}, "python" => {}, "typescript" => {},