Skip to content

Commit

Permalink
[squash-me] revert argparse action and move checking up
Browse files Browse the repository at this point in the history
 * previous patches squashed
 * removed argparse action solution
 * move the checking of arg to the beginning of the main function to
   preceed all other analysis steps
 * same checking is introduced at the beginning of check's main function
  • Loading branch information
Endre Fülöp committed Jan 28, 2021
1 parent 300529c commit b4df1d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions analyzer/codechecker_analyzer/cmd/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,11 @@ def main(args):
"""
logger.setup_logger(args.verbose if 'verbose' in args else None)

# CTU loading mode is only meaningful if CTU itself is enabled.
if 'ctu_ast_mode' in args and 'ctu_phases' not in args:
LOG.error("Analyzer option 'ctu-ast-mode' requires CTU mode enabled")
sys.exit(1)

try:
cmd_config.check_config_file(args)
except FileNotFoundError as fnerr:
Expand Down Expand Up @@ -857,11 +862,6 @@ def main(args):
# Process the skip list if present.
skip_handler = __get_skip_handler(args)

# CTU loading mode is only meaningful if CTU itself is enabled.
if 'ctu_ast_mode' in args and 'ctu_phases' not in args:
LOG.error("Analyzer option 'ctu-ast-mode' requires CTU mode enabled")
sys.exit(1)

# Enable alpha uniqueing by default if ctu analysis is used.
if 'none' in args.compile_uniqueing and 'ctu_phases' in args:
args.compile_uniqueing = "alpha"
Expand Down
5 changes: 5 additions & 0 deletions analyzer/codechecker_analyzer/cmd/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import argparse
import os
import shutil
import sys
import tempfile

from codechecker_analyzer import analyzer_context
Expand Down Expand Up @@ -731,6 +732,10 @@ def main(args):

logger.setup_logger(args.verbose if 'verbose' in args else None)

if 'ctu_ast_mode' in args and 'ctu_phases' not in args:
LOG.error("Analyzer option 'ctu-ast-mode' requires CTU mode enabled")
sys.exit(1)

def __update_if_key_exists(source, target, key):
"""Append the source Namespace's element with 'key' to target with
the same key, but only if it exists."""
Expand Down

0 comments on commit b4df1d5

Please sign in to comment.