diff --git a/.ci-ignore b/.ci-ignore index afba914c..b9610532 100644 --- a/.ci-ignore +++ b/.ci-ignore @@ -1,2 +1,2 @@ -python_action +cpp_linter mkdocs.yml diff --git a/.github/workflows/build-docs.bak b/.github/workflows/build-docs.bak deleted file mode 100644 index 721744b3..00000000 --- a/.github/workflows/build-docs.bak +++ /dev/null @@ -1,32 +0,0 @@ -name: dev-docs - -on: - push: - pull_request: - types: [opened] - -jobs: - using-mkdocs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install doc's deps - run: | - python3 -m pip install -r docs/requirements.txt - python3 -m pip install . - - name: Build docs - run: mkdocs build - - name: Save artifact - uses: actions/upload-artifact@v2 - with: - name: "cpp linter action dev docs" - path: site/** - - name: upload to github pages - if: ${{ github.event_name == 'release'}} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: site diff --git a/.github/workflows/run-pylint.yml b/.github/workflows/run-pylint.yml index 3ef7c8bd..0d103b95 100644 --- a/.github/workflows/run-pylint.yml +++ b/.github/workflows/run-pylint.yml @@ -25,5 +25,5 @@ jobs: python3 -m pip install -r requirements.txt - name: run pylint run: | - pylint python_action/** + pylint cpp_linter/** pylint setup.py diff --git a/Dockerfile b/Dockerfile index 9c0a20f5..43fb1064 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,11 +16,11 @@ RUN apt-get update RUN apt-get -y install python3-pip # RUN python3 -m pip install --upgrade pip -COPY python_action/ pkg/python_action/ +COPY cpp_linter/ pkg/cpp_linter/ COPY setup.py pkg/setup.py RUN python3 -m pip install pkg/ # github action args use the CMD option # See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runsargs # also https://docs.docker.com/engine/reference/builder/#cmd -ENTRYPOINT [ "python3", "-m", "python_action.run" ] +ENTRYPOINT [ "python3", "-m", "cpp_linter.run" ] diff --git a/README.md b/README.md index 55f24f23..dab2bce8 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ jobs: #### `tidy-checks` - **Description**: Comma-separated list of globs with optional '-' prefix. Globs are processed in order of appearance in the list. Globs without '-' prefix add checks with matching names to the set, globs with the '-' prefix remove checks with matching names from the set of enabled checks. This option's value is appended to the value of the 'Checks' option in a .clang-tidy file (if any). + - It is possible to disable clang-tidy entirely by setting this option to '-\*'. This allows using only clang-format to lint your source files. - Default: 'boost-\*,bugprone-\*,performance-\*,readability-\*,portability-\*,modernize-\*,clang-analyzer-\*,cppcoreguidelines-\*' #### `repo-root` diff --git a/python_action/__init__.py b/cpp_linter/__init__.py similarity index 76% rename from python_action/__init__.py rename to cpp_linter/__init__.py index 613a5a2f..ae8d6e96 100644 --- a/python_action/__init__.py +++ b/cpp_linter/__init__.py @@ -1,4 +1,4 @@ -"""The Base module of the `python_action` package. This holds the objects shared by +"""The Base module of the `cpp_linter` package. This holds the objects shared by multiple modules.""" import io import os @@ -24,7 +24,7 @@ logger.debug("rich module not found") # global constant variables -GITHUB_SHA = os.getenv("GITHUB_SHA", "95915a282b3efcad67b9ad3f95fba1501e43ab22") +GITHUB_SHA = os.getenv("GITHUB_SHA", "") GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", os.getenv("GIT_REST_API", "")) API_HEADERS = { "Authorization": f"token {GITHUB_TOKEN}", @@ -54,13 +54,13 @@ class GlobalParser: tidy_notes = [] """This can only be a `list` of type - [`TidyNotification`][python_action.clang_tidy.TidyNotification]""" + [`TidyNotification`][cpp_linter.clang_tidy.TidyNotification]""" tidy_advice = [] """This can only be a `list` of type - [`YMLFixit`][python_action.clang_tidy_yml.YMLFixit]""" + [`YMLFixit`][cpp_linter.clang_tidy_yml.YMLFixit]""" format_advice = [] """This can only be a `list` of type - [`XMLFixit`][python_action.clang_format_xml.XMLFixit]""" + [`XMLFixit`][cpp_linter.clang_format_xml.XMLFixit]""" def get_line_cnt_from_cols(file_path: str, offset: int) -> tuple: @@ -80,24 +80,20 @@ def get_line_cnt_from_cols(file_path: str, offset: int) -> tuple: last_lf_pos = 0 cols = 1 file_path = file_path.replace("/", os.sep) - with io.open(file_path, "r", encoding="utf-8", newline="\n") as src_file: - src_file.seek(0, io.SEEK_END) - max_len = src_file.tell() + # logger.debug("Getting line count from %s at offset %d", file_path, offset) + with io.open(file_path, "rb") as src_file: + max_len = src_file.seek(0, io.SEEK_END) src_file.seek(0, io.SEEK_SET) while src_file.tell() != offset and src_file.tell() < max_len: char = src_file.read(1) - if char == "\n": + if char == b"\n": line_cnt += 1 last_lf_pos = src_file.tell() - 1 # -1 because LF is part of offset - if last_lf_pos + 1> max_len: - src_file.newlines = "\r\n" - src_file.seek(0, io.SEEK_SET) - line_cnt = 1 cols = src_file.tell() - last_lf_pos return (line_cnt, cols) def log_response_msg(): - """Output the response buffer's message on failed request""" + """Output the response buffer's message on a failed request.""" if Globals.response_buffer.status_code>= 400: logger.error("response returned message: %s", Globals.response_buffer.text) diff --git a/python_action/clang_format_xml.py b/cpp_linter/clang_format_xml.py similarity index 93% rename from python_action/clang_format_xml.py rename to cpp_linter/clang_format_xml.py index ea98f0f2..3657c5ce 100644 --- a/python_action/clang_format_xml.py +++ b/cpp_linter/clang_format_xml.py @@ -37,7 +37,7 @@ class FormatReplacementLine: Attributes: line (int): The line number of where the suggestion starts replacements (list): A list of - [`FormatReplacement`][python_action.clang_format_xml.FormatReplacement] + [`FormatReplacement`][cpp_linter.clang_format_xml.FormatReplacement] object(s) representing suggestions. """ @@ -63,7 +63,7 @@ class XMLFixit: filename (str): The source file that the suggestion concerns. replaced_lines (list): A list of [`FormatReplacementLine`][ - python_action.clang_format_xml.FormatReplacementLine] + cpp_linter.clang_format_xml.FormatReplacementLine] representing replacement(s) on a single line. """ @@ -118,7 +118,7 @@ def log_command(self, style: str) -> str: def parse_format_replacements_xml(src_filename: str): """Parse XML output of replacements from clang-format. Output is saved to - [`format_advice`][python_action.__init__.GlobalParser.format_advice]. + [`format_advice`][cpp_linter.__init__.GlobalParser.format_advice]. Args: src_filename: The source file's name for which the contents of the xml @@ -145,8 +145,8 @@ def parse_format_replacements_xml(src_filename: str): def print_fixits(): - """Print all [`XMLFixit`][python_action.clang_format_xml.XMLFixit] objects in - [`format_advice`][python_action.__init__.GlobalParser.format_advice].""" + """Print all [`XMLFixit`][cpp_linter.clang_format_xml.XMLFixit] objects in + [`format_advice`][cpp_linter.__init__.GlobalParser.format_advice].""" for fixit in GlobalParser.format_advice: print(repr(fixit)) for line_fix in fixit.replaced_lines: diff --git a/python_action/clang_tidy.py b/cpp_linter/clang_tidy.py similarity index 79% rename from python_action/clang_tidy.py rename to cpp_linter/clang_tidy.py index f9a77bbb..55770b73 100644 --- a/python_action/clang_tidy.py +++ b/cpp_linter/clang_tidy.py @@ -1,9 +1,9 @@ """Parse output from clang-tidy's stdout""" import os -import sys import re -from . import GlobalParser +from . import GlobalParser # , logger +NOTE_HEADER = re.compile("^(.*):(\d+):(\d+):\s(\w+):(.*)\[(.*)\]$") class TidyNotification: """Create a object that decodes info from the clang-tidy output's initial line that @@ -20,27 +20,24 @@ class TidyNotification: notification. """ - def __init__(self, notification_line: str): + def __init__(self, notification_line: tuple): """ Args: - notification_line: The first line in the notification. + notification_line: The first line in the notification parsed into a tuple of + string that represent the different components of the notification's + details. """ - sliced_line = notification_line.split(":") - if sys.platform.startswith("win32") and len(sliced_line)> 5: - # sliced_list items 0 & 1 are the path seperated at the ":". - # we need to re-assemble the path for correct list expansion (see below) - sliced_line = [sliced_line[0] + ":" + sliced_line[1]] + sliced_line[2:] + # logger.debug("Creating tidy note from line %s", notification_line) ( self.filename, self.line, self.cols, self.note_type, self.note_info, - ) = sliced_line + self.diagnostic, + ) = notification_line - self.diagnostic = re.search("\[.*\]", self.note_info).group(0) - self.note_info = self.note_info.replace(self.diagnostic, "").strip() - self.diagnostic = self.diagnostic[1:-1] + self.note_info = self.note_info.strip() self.note_type = self.note_type.strip() self.line = int(self.line) self.cols = int(self.cols) @@ -90,8 +87,9 @@ def parse_tidy_output() -> None: notification = None with open("clang_tidy_report.txt", "r", encoding="utf-8") as tidy_out: for line in tidy_out.readlines(): - if re.search("^.*:\d+:\d+:\s\w+:.*\[.*\]$", line) is not None: - notification = TidyNotification(line) + match = re.match(NOTE_HEADER, line) + if match is not None: + notification = TidyNotification(match.groups()) GlobalParser.tidy_notes.append(notification) elif notification is not None: notification.fixit_lines.append(line) @@ -100,7 +98,7 @@ def parse_tidy_output() -> None: def print_fixits(): """Print out all clang-tidy notifications from stdout (which are saved to clang_tidy_report.txt and allocated to - [`tidy_notes`][python_action.__init__.GlobalParser.tidy_notes].""" + [`tidy_notes`][cpp_linter.__init__.GlobalParser.tidy_notes].""" for notification in GlobalParser.tidy_notes: print("found", len(GlobalParser.tidy_notes), "tidy_notes") print(repr(notification)) diff --git a/python_action/clang_tidy_yml.py b/cpp_linter/clang_tidy_yml.py similarity index 92% rename from python_action/clang_tidy_yml.py rename to cpp_linter/clang_tidy_yml.py index 89476f5e..9cb377b4 100644 --- a/python_action/clang_tidy_yml.py +++ b/cpp_linter/clang_tidy_yml.py @@ -20,7 +20,7 @@ class TidyDiagnostic: cols (int): The columns of the `line` that triggered the diagnostic null_len (int): The number of bytes replaced by suggestions replacements (list): The `list` of - [`TidyReplacement`][python_action.clang_tidy_yml.TidyReplacement] objects. + [`TidyReplacement`][cpp_linter.clang_tidy_yml.TidyReplacement] objects. """ @@ -79,7 +79,7 @@ class YMLFixit: Attributes: filename (str): The source file's name concerning the suggestion. diagnostics (list): The `list` of - [`TidyDiagnostic`][python_action.clang_tidy_yml.TidyDiagnostic] objects. + [`TidyDiagnostic`][cpp_linter.clang_tidy_yml.TidyDiagnostic] objects. """ def __init__(self, filename: str) -> None: @@ -99,7 +99,7 @@ def __repr__(self) -> str: def parse_tidy_suggestions_yml(): """Read a YAML file from clang-tidy and create a list of suggestions from it. - Output is saved to [`tidy_advice`][python_action.__init__.GlobalParser.tidy_advice]. + Output is saved to [`tidy_advice`][cpp_linter.__init__.GlobalParser.tidy_advice]. """ yml = {} with open("clang_tidy_output.yml", "r", encoding="utf-8") as yml_file: @@ -129,8 +129,8 @@ def parse_tidy_suggestions_yml(): def print_fixits(): - """Print all [`YMLFixit`][python_action.clang_tidy_yml.YMLFixit] objects in - [`tidy_advice`][python_action.__init__.GlobalParser.tidy_advice].""" + """Print all [`YMLFixit`][cpp_linter.clang_tidy_yml.YMLFixit] objects in + [`tidy_advice`][cpp_linter.__init__.GlobalParser.tidy_advice].""" for fix in GlobalParser.tidy_advice: for diag in fix.diagnostics: print(repr(diag)) diff --git a/python_action/run.py b/cpp_linter/run.py similarity index 91% rename from python_action/run.py rename to cpp_linter/run.py index e97d11bd..ea416cbf 100644 --- a/python_action/run.py +++ b/cpp_linter/run.py @@ -1,5 +1,5 @@ """Run clang-tidy and clang-format on a list of changed files provided by GitHub's -REST API. If executed from command-line, then [`main()`][python_action.run.main] is +REST API. If executed from command-line, then [`main()`][cpp_linter.run.main] is the entrypoint. !!! info "See Also" @@ -35,10 +35,10 @@ # global constant variables -GITHUB_EVEN_PATH = os.getenv("GITHUB_EVENT_PATH", "event_payload.json") +GITHUB_EVEN_PATH = os.getenv("GITHUB_EVENT_PATH", "") GITHUB_API_URL = os.getenv("GITHUB_API_URL", "https://api.github.com") -GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "2bndy5/cpp-linter-action") -GITHUB_EVENT_NAME = os.getenv("GITHUB_EVENT_NAME", "pull_request") +GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "") +GITHUB_EVENT_NAME = os.getenv("GITHUB_EVENT_NAME", "unknown") # setup CLI args cli_arg_parser = argparse.ArgumentParser( @@ -104,14 +104,14 @@ ) cli_arg_parser.add_argument( "--files-changed-only", - default="true", + default="false", type=lambda input: input.lower() == "true", help="Set this option to 'false' to analyse any source files in the repo. " "Defaults to %(default)s.", ) cli_arg_parser.add_argument( "--thread-comments", - default="true", + default="false", type=lambda input: input.lower() == "true", help="Set this option to false to disable the use of thread comments as feedback." "Defaults to %(default)s.", @@ -173,9 +173,11 @@ def is_file_in_list(paths: list, file_name: str, prompt: str) -> bool: result = os.path.commonpath([path, file_name]).replace(os.sep, "/") if result == path: logger.debug( - '"./%s" is %s as specified in the domain "./%s"', + '".%s%s" is %s as specified in the domain ".%s%s"', + os.sep, file_name, prompt, + os.sep, path, ) return True @@ -184,7 +186,8 @@ def is_file_in_list(paths: list, file_name: str, prompt: str) -> bool: def get_list_of_changed_files() -> None: """Fetch the JSON payload of the event's changed files. Sets the - [`FILES`][python_action.__init__.Globals.FILES] attribute.""" + [`FILES`][cpp_linter.__init__.Globals.FILES] attribute.""" + start_log_group("Get list of specified source files") files_link = f"{GITHUB_API_URL}/repos/{GITHUB_REPOSITORY}/" if GITHUB_EVENT_NAME == "pull_request": files_link += f"pulls/{Globals.EVENT_PAYLOAD['number']}/files" @@ -201,7 +204,7 @@ def filter_out_non_source_files( ext_list: list, ignored: list, not_ignored: list, lines_changed_only: bool ) -> bool: """Exclude undesired files (specified by user input 'extensions'). This filter - applies to the event's [`FILES`][python_action.__init__.Globals.FILES] attribute. + applies to the event's [`FILES`][cpp_linter.__init__.Globals.FILES] attribute. Args: ext_list: A list of file extensions that are to be examined. @@ -212,7 +215,7 @@ def filter_out_non_source_files( Returns: True if there are files to check. False will invoke a early exit (in - [`main()`][python_action.run.main]) when no files to be checked. + [`main()`][cpp_linter.run.main]) when no files to be checked. """ files = [] for file in ( @@ -296,7 +299,7 @@ def verify_files_are_present() -> None: def list_source_files(ext_list: list, ignored_paths: list, not_ignored: list) -> bool: """Make a list of source files to be checked. The resulting list is stored in - [`FILES`][python_action.__init__.Globals.FILES]. + [`FILES`][cpp_linter.__init__.Globals.FILES]. Args: ext_list: A list of file extensions that should by attended. @@ -305,8 +308,9 @@ def list_source_files(ext_list: list, ignored_paths: list, not_ignored: list) -> Returns: True if there are files to check. False will invoke a early exit (in - [`main()`][python_action.run.main]) when no files to be checked. + [`main()`][cpp_linter.run.main]) when no files to be checked. """ + start_log_group("Get list of specified source files") if os.path.exists(".gitmodules"): submodules = configparser.ConfigParser() submodules.read(".gitmodules") @@ -319,14 +323,20 @@ def list_source_files(ext_list: list, ignored_paths: list, not_ignored: list) -> root_path = os.getcwd() for dirpath, _, filenames in os.walk(root_path): path = dirpath.replace(root_path, "").lstrip(os.sep) - if path.startswith("."): - # logger.debug("Skipping \"%s\"", path) + path_parts = path.split(os.sep) + is_hidden = False + for part in path_parts: + if part.startswith("."): + # logger.debug("Skipping \".%s%s\"", os.sep, path) + is_hidden = True + break + if is_hidden: continue # skip sources in hidden directories - logger.debug('Crawling "./%s"', path) + logger.debug('Crawling ".%s%s"', os.sep, path) for file in filenames: if os.path.splitext(file)[1][1:] in ext_list: file_path = os.path.join(path, file) - logger.debug('"./%s" is a source code file', file_path) + logger.debug('".%s%s" is a source code file', os.sep, file_path) if not is_file_in_list( ignored_paths, file_path, "ignored" ) or is_file_in_list(not_ignored, file_path, "not ignored"): @@ -357,6 +367,10 @@ def run_clang_tidy( lines_changed_only: A flag that forces focus on only changes in the event's diff info. """ + if checks == "-*": # if all checks are disabled, then clang-tidy is skipped + # clear the clang-tidy output file and exit function + with open("clang_tidy_report.txt", "wb") as f_out: + return cmds = [f"clang-tidy-{version}"] if sys.platform.startswith("win32"): cmds = ["clang-tidy"] @@ -370,6 +384,7 @@ def run_clang_tidy( cmds.append(filename.replace("/", os.sep)) with open("clang_tidy_output.yml", "wb"): pass # clear yml file's content before running clang-tidy + logger.info('Running "%s"', " ".join(cmds)) results = subprocess.run(cmds, capture_output=True) with open("clang_tidy_report.txt", "wb") as f_out: f_out.write(results.stdout) @@ -405,11 +420,10 @@ def run_clang_format( for line_range in file_obj["line_filter"]["lines"]: cmds.append(f"--lines={line_range[0]}:{line_range[1]}") cmds.append(filename.replace("/", os.sep)) + logger.info('Running "%s"', " ".join(cmds)) results = subprocess.run(cmds, capture_output=True) with open("clang_format_output.xml", "wb") as f_out: f_out.write(results.stdout) - if results.stdout: - logger.debug("clang-format has suggestions.") if results.returncode: logger.warning( "%s raised the following error(s):\n%s", cmds[0], results.stderr.decode() @@ -420,7 +434,7 @@ def capture_clang_tools_output( version: str, checks: str, style: str, lines_changed_only: bool ): """Execute and capture all output from clang-tidy and clang-format. This aggregates - results in the [`OUTPUT`][python_action.__init__.Globals.OUTPUT]. + results in the [`OUTPUT`][cpp_linter.__init__.Globals.OUTPUT]. Args: version: The version of clang-tidy to run. @@ -455,8 +469,8 @@ def capture_clang_tools_output( tidy_notes.append(note) GlobalParser.tidy_notes.clear() # empty list to avoid duplicated output - if os.path.getsize("clang_format_output.xml"): - parse_format_replacements_xml(filename.replace("/", os.sep)) + parse_format_replacements_xml(filename.replace("/", os.sep)) + if GlobalParser.format_advice[-1].replaced_lines: if not Globals.OUTPUT: Globals.OUTPUT = "\n## :scroll: " Globals.OUTPUT += "Run `clang-format` on the following files\n" @@ -636,12 +650,17 @@ def make_annotations(style: str) -> bool: """ # log_commander obj's verbosity is hard-coded to show debug statements ret_val = False + count = 0 for note in GlobalParser.tidy_notes: ret_val = True log_commander.info(note.log_command()) + count += 1 for note in GlobalParser.format_advice: - ret_val = True - log_commander.info(note.log_command(style)) + if note.replaced_lines: + ret_val = True + log_commander.info(note.log_command(style)) + count += 1 + logger.info("Created %d annotations", count) return ret_val @@ -671,18 +690,9 @@ def main(): logger.info("processing %s event", GITHUB_EVENT_NAME) - # load event's json info about the workflow run - with open(GITHUB_EVEN_PATH, "r", encoding="utf-8") as payload: - Globals.EVENT_PAYLOAD = json.load(payload) - if logger.getEffectiveLevel() <= logging.DEBUG: - start_log_group("Event json from the runner") - logger.debug(json.dumps(Globals.EVENT_PAYLOAD)) - end_log_group() - # change working directory os.chdir(args.repo_root) - start_log_group("Get list of specified source files") if ignored: logger.info( "Ignoring the following paths/files:\n\t%s", @@ -695,6 +705,13 @@ def main(): ) exit_early = False if args.files_changed_only: + # load event's json info about the workflow run + with open(GITHUB_EVEN_PATH, "r", encoding="utf-8") as payload: + Globals.EVENT_PAYLOAD = json.load(payload) + if logger.getEffectiveLevel() <= logging.DEBUG: + start_log_group("Event json from the runner") + logger.debug(json.dumps(Globals.EVENT_PAYLOAD)) + end_log_group() get_list_of_changed_files() exit_early = not filter_out_non_source_files( args.extensions, diff --git a/python_action/thread_comments.py b/cpp_linter/thread_comments.py similarity index 100% rename from python_action/thread_comments.py rename to cpp_linter/thread_comments.py diff --git a/docs/API Reference/python_action.clang_format_xml.md b/docs/API Reference/cpp_linter.clang_format_xml.md similarity index 74% rename from docs/API Reference/python_action.clang_format_xml.md rename to docs/API Reference/cpp_linter.clang_format_xml.md index 47dc0fef..8f7a76c8 100644 --- a/docs/API Reference/python_action.clang_format_xml.md +++ b/docs/API Reference/cpp_linter.clang_format_xml.md @@ -3,4 +3,4 @@ !!! info This API is experimental and not actually used in production. -::: python_action.clang_format_xml +::: cpp_linter.clang_format_xml diff --git a/docs/API Reference/cpp_linter.clang_tidy.md b/docs/API Reference/cpp_linter.clang_tidy.md new file mode 100644 index 00000000..689b12e0 --- /dev/null +++ b/docs/API Reference/cpp_linter.clang_tidy.md @@ -0,0 +1,3 @@ +# clang_tidy module + +::: cpp_linter.clang_tidy diff --git a/docs/API Reference/python_action.clang_tidy_yml.md b/docs/API Reference/cpp_linter.clang_tidy_yml.md similarity index 75% rename from docs/API Reference/python_action.clang_tidy_yml.md rename to docs/API Reference/cpp_linter.clang_tidy_yml.md index 4b01f8d9..7db0ae26 100644 --- a/docs/API Reference/python_action.clang_tidy_yml.md +++ b/docs/API Reference/cpp_linter.clang_tidy_yml.md @@ -3,4 +3,4 @@ !!! info This API is experimental and not actually used in production. -::: python_action.clang_tidy_yml +::: cpp_linter.clang_tidy_yml diff --git a/docs/API Reference/cpp_linter.md b/docs/API Reference/cpp_linter.md new file mode 100644 index 00000000..31b45342 --- /dev/null +++ b/docs/API Reference/cpp_linter.md @@ -0,0 +1,3 @@ +# Base module + +::: cpp_linter.__init__ diff --git a/docs/API Reference/cpp_linter.run.md b/docs/API Reference/cpp_linter.run.md new file mode 100644 index 00000000..4563d550 --- /dev/null +++ b/docs/API Reference/cpp_linter.run.md @@ -0,0 +1,3 @@ +# Run module + +::: cpp_linter.run diff --git a/docs/API Reference/cpp_linter.thread_comments.md b/docs/API Reference/cpp_linter.thread_comments.md new file mode 100644 index 00000000..17a801bc --- /dev/null +++ b/docs/API Reference/cpp_linter.thread_comments.md @@ -0,0 +1,3 @@ +# thread_comments module + +::: cpp_linter.thread_comments diff --git a/docs/API Reference/python_action.clang_tidy.md b/docs/API Reference/python_action.clang_tidy.md deleted file mode 100644 index 754f8f57..00000000 --- a/docs/API Reference/python_action.clang_tidy.md +++ /dev/null @@ -1,3 +0,0 @@ -# clang_tidy module - -::: python_action.clang_tidy diff --git a/docs/API Reference/python_action.md b/docs/API Reference/python_action.md deleted file mode 100644 index ae028699..00000000 --- a/docs/API Reference/python_action.md +++ /dev/null @@ -1,3 +0,0 @@ -# Base module - -::: python_action.__init__ diff --git a/docs/API Reference/python_action.run.md b/docs/API Reference/python_action.run.md deleted file mode 100644 index 281b0fd6..00000000 --- a/docs/API Reference/python_action.run.md +++ /dev/null @@ -1,3 +0,0 @@ -# Run module - -::: python_action.run diff --git a/docs/API Reference/python_action.thread_comments.md b/docs/API Reference/python_action.thread_comments.md deleted file mode 100644 index e83bebae..00000000 --- a/docs/API Reference/python_action.thread_comments.md +++ /dev/null @@ -1,3 +0,0 @@ -# thread_comments module - -::: python_action.thread_comments diff --git a/img/demo_comment.png b/img/demo_comment.png new file mode 100644 index 00000000..10404421 Binary files /dev/null and b/img/demo_comment.png differ diff --git a/mkdocs.yml b/mkdocs.yml index 609a75d5..d12bc632 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,12 +7,12 @@ repo_name: "shenxianpeng/cpp-linter-action" nav: - index.md - "Dev Docs": - - API Reference/python_action.md - - API Reference/python_action.run.md - - API Reference/python_action.clang_tidy.md - - API Reference/python_action.clang_tidy_yml.md - - API Reference/python_action.clang_format_xml.md - - API Reference/python_action.thread_comments.md + - API Reference/cpp_linter.md + - API Reference/cpp_linter.run.md + - API Reference/cpp_linter.clang_tidy.md + - API Reference/cpp_linter.clang_tidy_yml.md + - API Reference/cpp_linter.clang_format_xml.md + - API Reference/cpp_linter.thread_comments.md theme: name: material @@ -52,7 +52,7 @@ plugins: show_source: true heading_level: 2 watch: - - python_action + - cpp_linter markdown_extensions: - admonition diff --git a/setup.py b/setup.py index 24de2052..9e422074 100644 --- a/setup.py +++ b/setup.py @@ -12,15 +12,15 @@ setup( - name="python_action", + name="cpp_linter", # use_scm_version=True, # setup_requires=["setuptools_scm"], - version="v1.2.1", + version="1.3.1", description=__doc__, long_description=".. warning:: this is not meant for PyPi (yet)", author="Brendan Doherty", author_email="2bndy5@gmail.com", - install_requires=["requests"], #, "pyyaml"], # pyyaml is installed with clang-tidy + install_requires=["requests", "pyyaml"], # pyyaml is installed with clang-tidy license="MIT", # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ @@ -30,9 +30,8 @@ "Programming Language :: Python :: 3", ], keywords="clang clang-tidy clang-format", - packages=["python_action"], - - entry_points={"console_scripts": ["run-action=python_action.run:main"]}, + packages=["cpp_linter"], + entry_points={"console_scripts": ["cpp-linter=cpp_linter.run:main"]}, # Specifiy your homepage URL for your project here url=REPO, download_url=f"{REPO}/releases",