#!python ## Copyright (c) 2020-2021 Thakee Nathees ## Distributed Under The MIT License ## This will run static checks on the source files, for line length, ## uses of tabs, and trailing white spaces, etc. import os, sys, re from os import listdir from os.path import ( join, abspath, dirname, relpath) ## The absolute path of this file, when run as a script. ## This file is not intended to be included in other files at the moment. THIS_PATH = abspath(dirname(__file__)) ## Converts a list of relative paths from the working directory ## to a list of relative paths from this file's absolute directory. def to_abs_paths(sources): return map(lambda s: os.path.join(THIS_PATH, s), sources) ## Converts the path from absolute path to relative path from the ## toplelve of the project. def to_tolevel_path(path): return relpath(path, join(THIS_PATH, '..')) ## A list of source files, to check if the fnv1a hash values match it's ## corresponding cstring in the CASE_ATTRIB(name, hash) macro calls. HASH_CHECK_LIST = [ "../src/pk_core.c", "../src/pk_var.c", ] ## A list of extension to perform static checks, of all the files in the ## SOURCE_DIRS. CHECK_EXTENTIONS = ('.c', '.h', '.py', '.pk', '.js') ## A list of strings, if a line contains it we allow it to be longer than ## 79 characters, It's not "the correct way" but it works. ALLOW_LONG = ('http://', 'https://', '