Skip to content

Commit e0cf35a

Browse files
committed
Added comment doc and comments to ignore
1 parent 6eb2eae commit e0cf35a

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

lib/cc/engine/analyzers/kotlin/main.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class Main < CC::Engine::Analyzers::Base
1616
DEFAULT_FILTERS = [
1717
"(IMPORT_LIST ___)".freeze,
1818
"(PACKAGE_DIRECTIVE ___)".freeze,
19+
"(KDoc ___)".freeze,
20+
"(EOL_COMMENT ___)".freeze,
1921
].freeze
2022
POINTS_PER_OVERAGE = 10_000
2123
REQUEST_PATH = "/kotlin".freeze

spec/cc/engine/analyzers/kotlin/kotlin_spec.rb

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,86 @@ class ArrayDemo {
193193
expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR)
194194
end
195195

196+
it "ignores comment docs and comments" do
197+
create_source_file("foo.kt", <<-EOF)
198+
/*******************************************************************************
199+
* *
200+
* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> *
201+
* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod.be> *
202+
* *
203+
* This program is free software: you can redistribute it and/or modify *
204+
* it under the terms of the GNU General Public License as published by *
205+
* the Free Software Foundation, either version 3 of the License, or *
206+
* (at your option) any later version. *
207+
* *
208+
* This program is distributed in the hope that it will be useful, *
209+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
210+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
211+
* GNU General Public License for more details. *
212+
* *
213+
* You should have received a copy of the GNU General Public License *
214+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
215+
* *
216+
*******************************************************************************/
217+
218+
package com.github.shadowsocks.acl
219+
// Comment here
220+
221+
import org.junit.Assert
222+
import org.junit.Test
223+
224+
class AclTest {
225+
// Comment here
226+
companion object {
227+
private const val INPUT1 = """[proxy_all]
228+
[bypass_list]
229+
1.0.1.0/24
230+
(^|\.)4tern\.com${'$'}
231+
"""
232+
}
233+
234+
@Test
235+
fun parse() {
236+
Assert.assertEquals(INPUT1, Acl().fromReader(INPUT1.reader()).toString());
237+
}
238+
}
239+
EOF
240+
241+
create_source_file("bar.kt", <<-EOF)
242+
/*******************************************************************************
243+
* *
244+
* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> *
245+
* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod.be> *
246+
* *
247+
* This program is free software: you can redistribute it and/or modify *
248+
* it under the terms of the GNU General Public License as published by *
249+
* the Free Software Foundation, either version 3 of the License, or *
250+
* (at your option) any later version. *
251+
* *
252+
* This program is distributed in the hope that it will be useful, *
253+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
254+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
255+
* GNU General Public License for more details. *
256+
* *
257+
* You should have received a copy of the GNU General Public License *
258+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
259+
* *
260+
*******************************************************************************/
261+
262+
package com.evernote.android.job
263+
// Comment here
264+
265+
object JobConstants {
266+
// Comment here
267+
const val DATABASE_NAME = JobStorage.DATABASE_NAME
268+
const val PREF_FILE_NAME = JobStorage.PREF_FILE_NAME
269+
}
270+
EOF
271+
272+
issues = run_engine(engine_conf).strip.split("\0")
273+
expect(issues).to be_empty
274+
end
275+
196276
end
197277
end
198278
end

0 commit comments

Comments
 (0)