Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
142 lines (120 sloc) 4.38 KB
# -*- coding: utf-8 -*-
import appdirs
import os
import re
import logging
from coalib import VERSION
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:')
VERSION_CONFLICT_MESSAGE = ('There is a conflict in the version of a '
'dependency you have installed and the '
'requirements of coala. This may be resolved by '
'creating a separate virtual environment for '
'coala or running `pip3 install "%s"`. Be aware '
'that the latter solution might break other '
'python packages that depend on the currently '
'installed version.')
OBJ_NOT_ACCESSIBLE = '{} is not accessible and will be ignored!'
'hell yeah',
'hell no',
'fat chance',
'not a chance in hell',
'not in a million years',
'out of the question',
'no siree',
'no way',
# This string contains many unicode characters to challenge tests.
COMPLEX_TEST_STRING = ('4 r34l ch4ll3n63: 123 ÄÖü ABc @€¥ §&% {[( ←↓→↑ '
'ĦŊħ ß°^ \\\n\u2192')
# Path to the coalib directory
coalib_root = os.path.join(os.path.dirname(__file__),
# Path to the language definition files
language_definitions = os.path.join(coalib_root,
def get_system_coafile(coalib_root):
if os.path.isfile(os.path.join(coalib_root, 'system_coafile')):
return os.path.join(coalib_root, 'system_coafile')
logging.warning('Filename default_coafile has been deprecated. '
'Please use system_coafile instead.')
return os.path.join(coalib_root, 'default_coafile')
system_coafile = get_system_coafile(coalib_root)
user_coafile = os.path.join(os.path.expanduser('~'), '.coarc')
default_coafile = '.coafile'
USER_DATA_DIR = appdirs.user_data_dir('coala', version=VERSION)
URL_REGEX = re.compile(
r'^(?:(?:http|ftp)[s]?://)?' # scheme
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+' # domain name
r'localhost|' # OR localhost
r'(?:\d{1,3}\.){3}\d{1,3})' # OR an ip
r'(?::\d+)?' # optional port number
r'(?:/?|[/?]\S+)$', # path