/
Constants.py
78 lines (60 loc) · 2.41 KB
/
Constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os
import platform
THIS_IS_A_BUG = ("This is a bug. We are sorry for the inconvenience. "
"Please contact the developers for assistance.")
CRASH_MESSAGE = ("An unknown error occurred. This is a bug. We are "
"sorry for the inconvenience. Please contact the "
"developers for assistance. During execution of "
"coala an exception was raised. This should never "
"happen. When asked for, the following information "
"may help investigating:")
OBJ_NOT_ACCESSIBLE = "{} is not accessible and will be ignored!"
TRUE_STRINGS = ['1',
"on",
'y',
'yes',
"yeah",
"sure",
'true',
'definitely',
'yup',
"right"]
FALSE_STRINGS = ['0',
'off',
'n',
'no',
'nope',
'nah',
'false',
"wrong"]
# This string contains many unicode characters to challenge tests.
COMPLEX_TEST_STRING = ("4 r34l ch4ll3n63: 123 ÄÖü ABc @€¥ §&% {[( ←↓→↑ "
"ĦŊħ ß°^ \\\n\u2192")
# Results from coverage for unittests are stored here.
COVERAGE_DIR = "./.coverageresults"
# Path to the coalib directory
coalib_root = os.path.join(os.path.dirname(__file__),
os.path.pardir)
# Path to the directory containing the default bears
coalib_bears_root = os.path.join(coalib_root, os.path.pardir, "bears")
# Path to the language definition files
language_definitions = os.path.join(coalib_root,
"bearlib",
"languages",
"definitions")
system_coafile = os.path.join(coalib_root, "default_coafile")
user_coafile = os.path.join(os.path.expanduser("~"), ".coarc")
default_coafile = ".coafile"
VERSION_FILE = os.path.join(coalib_root, "VERSION")
with open(VERSION_FILE, 'r') as ver:
VERSION = ver.readline().strip()
BUS_NAME = "org.coala_analyzer.v1"
if platform.system() == 'Windows': # pragma: no cover
USER_DIR = os.path.join(os.getenv("APPDATA"), "coala")
else:
USER_DIR = os.path.join(os.path.expanduser("~"), ".local", "coala")
TAGS_DIR = os.path.join(USER_DIR, "tags")
try:
os.makedirs(TAGS_DIR)
except: # pragma: no cover
pass