Skip to content

Commit

Permalink
Add Clojure support
Browse files Browse the repository at this point in the history
This includes comments recognition and basic metrics.
  • Loading branch information
sarcilav committed Sep 11, 2017
1 parent ba1c334 commit 11ccc3a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gitinspector/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
__comment__ = {"java": "//", "c": "//", "cc": "//", "cpp": "//", "cs": "//", "h": "//", "hh": "//", "hpp": "//", "hs": "--",
"pl": "#", "php": "//", "py": "#", "glsl": "//", "rb": "#", "robot": "#", "rs": "//", "rlib": "//", "js": "//",
"scala": "//", "sql": "--", "tex": "%", "ada": "--", "ads": "--", "adb": "--", "pot": "#", "po": "#", "go": "//",
"ly": "%", "ily": "%"}
"ly": "%", "ily": "%", "clj": ";", "cljs": ";", "cljc": ";"}

__comment_markers_must_be_at_begining__ = {"tex": True}

Expand Down
2 changes: 1 addition & 1 deletion gitinspector/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from __future__ import unicode_literals

DEFAULT_EXTENSIONS = ["java", "c", "cc", "cpp", "h", "hh", "hpp", "py", "glsl", "rb", "js", "sql"]
DEFAULT_EXTENSIONS = ["java", "c", "cc", "cpp", "h", "hh", "hpp", "py", "glsl", "rb", "js", "sql", "clj", "cljs", "cljc"]

__extensions__ = DEFAULT_EXTENSIONS
__located_extensions__ = set()
Expand Down
6 changes: 4 additions & 2 deletions gitinspector/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from . import comment, filtering, interval

__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "cs": 500, "h": 300, "hpp": 300, "php": 500, "py": 500, "glsl": 1000,
"rb": 500, "js": 500, "sql": 1000, "xml": 1000}
"rb": 500, "js": 500, "sql": 1000, "xml": 1000, "clj": 500, "cljs": 500, "cljc": 500}

__metric_cc_tokens__ = [[["java", "js", "c", "cc", "cpp"], ["else", r"for\s+\(.*\)", r"if\s+\(.*\)", r"case\s+\w+:",
"default:", r"while\s+\(.*\)"],
Expand All @@ -33,7 +33,9 @@
"default:", r"while\s+\(.*\)"],
["assert", "break", "continue", "return"]],
[["py"], [r"^\s+elif .*:$", r"^\s+else:$", r"^\s+for .*:", r"^\s+if .*:$", r"^\s+while .*:$"],
[r"^\s+assert", "break", "continue", "return"]]]
[r"^\s+assert", "break", "continue", "return"]],
[["clj", "cljs", "cljs"], ["\("],
["assert"]]]

METRIC_CYCLOMATIC_COMPLEXITY_THRESHOLD = 50
METRIC_CYCLOMATIC_COMPLEXITY_DENSITY_THRESHOLD = 0.75
Expand Down

0 comments on commit 11ccc3a

Please sign in to comment.