Skip to content

Commit 18080c5

Browse files
committed
Remove --config parsing and handling
Previously deprecated in 1.2.0. Signed-off-by: John Pennycook <john.pennycook@intel.com>
1 parent f078b6e commit 18080c5

File tree

1 file changed

+5
-57
lines changed

1 file changed

+5
-57
lines changed

bin/codebasin

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import argparse
99
import logging
1010
import os
1111
import sys
12-
import warnings
1312

1413
from codebasin import config, finder, report, util
1514
from codebasin.walkers.platform_mapper import PlatformMapper
@@ -56,15 +55,6 @@ def main():
5655
version=f"Code Base Investigator {version}",
5756
help="Display version information and exit.",
5857
)
59-
deprecated_args = parser.add_argument_group("deprecated options")
60-
deprecated_args.add_argument(
61-
"-c",
62-
"--config",
63-
dest="config_file",
64-
metavar="<config-file>",
65-
action="store",
66-
help="Configuration YAML file. " + "Defaults to config.yaml.",
67-
)
6858
parser.add_argument(
6959
"-v",
7060
"--verbose",
@@ -140,22 +130,6 @@ def main():
140130
# Determine the root directory based on where codebasin is run.
141131
rootdir = os.path.realpath(os.getcwd())
142132

143-
if args.config_file and args.analysis_file:
144-
raise RuntimeError(
145-
"Cannot use --config (-c) with TOML analysis files.",
146-
)
147-
148-
# If no file is specified, legacy behavior checks for config.yaml
149-
config_file = args.config_file
150-
if args.config_file is None and args.analysis_file is None:
151-
warnings.warn(
152-
"Implicitly defined configuration files are deprecated.",
153-
DeprecationWarning,
154-
)
155-
config_file = os.path.join(rootdir, "config.yaml")
156-
if not os.path.exists(config_file):
157-
raise RuntimeError(f"Could not find config file {config_file}")
158-
159133
# Set up a default codebase and configuration object.
160134
codebase = {
161135
"files": [],
@@ -166,25 +140,6 @@ def main():
166140
}
167141
configuration = {}
168142

169-
# Load the configuration file if it exists, obeying any platform filter.
170-
if config_file is not None:
171-
warnings.warn(
172-
"YAML configuration files are deprecated. "
173-
+ "Use TOML analysis files instead.",
174-
DeprecationWarning,
175-
)
176-
if not util.ensure_yaml(config_file):
177-
logging.getLogger("codebasin").error(
178-
"Configuration file does not have YAML file extension.",
179-
)
180-
sys.exit(1)
181-
codebase, configuration = config.load(
182-
config_file,
183-
rootdir,
184-
exclude_patterns=args.excludes,
185-
filtered_platforms=args.platforms,
186-
)
187-
188143
# Load the analysis file if it exists.
189144
if args.analysis_file is not None:
190145
path = os.path.realpath(args.analysis_file)
@@ -222,12 +177,11 @@ def main():
222177

223178
# Parse the source tree, and determine source line associations.
224179
# The trees and associations are housed in state.
225-
legacy_warnings = True if config_file else False
226180
state = finder.find(
227181
rootdir,
228182
codebase,
229183
configuration,
230-
legacy_warnings=legacy_warnings,
184+
legacy_warnings=False,
231185
)
232186

233187
# Count lines for platforms
@@ -247,16 +201,10 @@ def main():
247201

248202
# Print clustering report
249203
if report_enabled("clustering"):
250-
# Legacy behavior: guess prefix from YAML filename
251-
if config_file is not None:
252-
output_prefix = os.path.realpath(guess_project_name(config_file))
253-
254-
# Modern behavior: append platforms to TOML filename
255-
else:
256-
basename = os.path.basename(args.analysis_file)
257-
filename = os.path.splitext(basename)[0]
258-
platform_names = [p for p in codebase["platforms"]]
259-
output_prefix = "-".join([filename] + platform_names)
204+
basename = os.path.basename(args.analysis_file)
205+
filename = os.path.splitext(basename)[0]
206+
platform_names = [p for p in codebase["platforms"]]
207+
output_prefix = "-".join([filename] + platform_names)
260208

261209
clustering_output_name = output_prefix + "-dendrogram.png"
262210
clustering = report.clustering(clustering_output_name, setmap)

0 commit comments

Comments
 (0)