normino 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
normino-0.1/PKG-INFO ADDED
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: normino
3
+ Version: 0.1
4
+ Summary: UNKNOWN
5
+ Home-page: UNKNOWN
6
+ License: UNKNOWN
7
+ Platform: UNKNOWN
8
+
9
+ UNKNOWN
10
+
normino-0.1/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Normino
2
+
3
+ Normino is a command-line tool that enhances the functionality of the `norminette` command, providing a more user-friendly and informative output for checking the coding style of your C files.
4
+
5
+ ## Features
6
+
7
+ - Colorized output for better readability
8
+ - Detailed error messages with line and column numbers
9
+ - Summary of correct files and files with errors
10
+ - Support for file patterns and additional `norminette` arguments
11
+
12
+ ## Installation
13
+
14
+ You can install Normino using pip:
15
+
16
+ ``​`
17
+ pip install normino
18
+ ``​`
19
+
20
+ Make sure you have `norminette` installed and accessible in your system's PATH.
21
+
22
+ ## Usage
23
+
24
+ To run Normino, simply use the `normino` command followed by the filenames or file patterns you want to check:
25
+
26
+ ``​`
27
+ normino file1.c file2.c
28
+ normino *.c
29
+ normino src/*.c include/*.h
30
+ ``​`
31
+
32
+ You can also provide additional arguments for `norminette` using the `-a` or `--args` option:
33
+
34
+ ``​`
35
+ normino -a -R CheckForbiddenSourceHeader file.c
36
+ ``​`
37
+
38
+ ### Options
39
+
40
+ - `-e`, `--error_only`: Display only errors
41
+ - `-s`, `--summary_only`: Display only the summary
42
+ - `-d`, `--detailed`: Display detailed error messages
43
+ - `-a`, `--args`: Additional arguments for `norminette`
44
+
45
+ ## Examples
46
+
47
+ Check all `.c` files in the current directory:
48
+
49
+ ``​`
50
+ normino *.c
51
+ ``​`
52
+
53
+ Check specific files and display only errors:
54
+
55
+ ``​`
56
+ normino file1.c file2.c -e
57
+ ``​`
58
+
59
+ Check files in the `src` directory and display a summary:
60
+
61
+ ``​`
62
+ normino src/*.c -s
63
+ ``​`
64
+
65
+ Check files with detailed error messages:
66
+
67
+ ``​`
68
+ normino file.c -d
69
+ ``​`
70
+
71
+ ## License
72
+
73
+ This project is licensed under the [MIT License](LICENSE).
74
+
75
+ ## Contributing
76
+
77
+ Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
78
+ https://github.com/SLDDL/Normino
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: normino
3
+ Version: 0.1
4
+ Summary: UNKNOWN
5
+ Home-page: UNKNOWN
6
+ License: UNKNOWN
7
+ Platform: UNKNOWN
8
+
9
+ UNKNOWN
10
+
@@ -0,0 +1,9 @@
1
+ README.md
2
+ normino.py
3
+ setup.py
4
+ normino.egg-info/PKG-INFO
5
+ normino.egg-info/SOURCES.txt
6
+ normino.egg-info/dependency_links.txt
7
+ normino.egg-info/entry_points.txt
8
+ normino.egg-info/requires.txt
9
+ normino.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ normino = normino:main
3
+
@@ -0,0 +1 @@
1
+ colorama
@@ -0,0 +1 @@
1
+ normino
normino-0.1/normino.py ADDED
@@ -0,0 +1,100 @@
1
+ import subprocess
2
+ import argparse
3
+ from pathlib import Path
4
+ from colorama import init, Fore, Style
5
+ init(autoreset=True)
6
+
7
+
8
+ def colorize_text(text, color):
9
+ return f"{color}{text}{Style.RESET_ALL}"
10
+
11
+
12
+ def parse_output_line(line, detailed=False):
13
+ parts = line.split()
14
+ file_path = parts[0].split(':')[0]
15
+ if "Error:" in line:
16
+ error_description = " ".join(parts[1:])
17
+ details = error_description.split('(')[1].split(')')[0]
18
+ line_number, col_number = details.replace(
19
+ 'line: ', '').replace('col: ', '').split(',')
20
+ error_name = error_description.split('(')[0].strip()
21
+ detail_text = error_description.split(
22
+ ')')[1].strip() if detailed else ''
23
+ error_info = f"\t{colorize_text(line_number, Fore.YELLOW)}\t{colorize_text(col_number, Fore.YELLOW)} {colorize_text(error_name, Fore.RED)}"
24
+ return error_info + f" {detail_text}" if detailed else error_info
25
+ if ": Error!" in line:
26
+ return f"{colorize_text(file_path, Fore.CYAN)}\t---\t--- {colorize_text('---', Fore.CYAN)}"
27
+ return None
28
+
29
+
30
+ def display_errors(errors):
31
+ print(colorize_text("File Line Col Error Description", Fore.YELLOW))
32
+ for error in errors:
33
+ print(error)
34
+
35
+
36
+ def run_norminette(cmd, error_only, summary_only, detailed):
37
+ print(colorize_text("Processing...", Fore.CYAN))
38
+ try:
39
+ result = subprocess.run(cmd, capture_output=True, text=True)
40
+ print("\033[A \033[A")
41
+ except subprocess.CalledProcessError as e:
42
+ print("\033[A \033[A")
43
+ print(colorize_text(
44
+ f"Failed to execute '{' '.join(cmd)}'. Make sure 'norminette' is installed and accessible.", Fore.RED))
45
+ print(colorize_text(f"Error details: {e}", Fore.YELLOW))
46
+ return
47
+ files_ok, errors = [], []
48
+ for line in result.stdout.splitlines():
49
+ if ": OK!" in line:
50
+ files_ok.append(line.split(":")[0])
51
+ else:
52
+ error_line = parse_output_line(line, detailed)
53
+ if error_line:
54
+ errors.append(error_line)
55
+ if not summary_only:
56
+ if files_ok and not error_only:
57
+ print(colorize_text(
58
+ "══════════════[ PASS ]══════════════════", Fore.GREEN))
59
+ print(colorize_text(", ".join(files_ok), Fore.GREEN))
60
+ if errors:
61
+ print()
62
+ if errors:
63
+ print(colorize_text(
64
+ "══════════════[ FAIL ]══════════════════", Fore.RED))
65
+ display_errors(errors)
66
+ if (summary_only or errors) and not error_only:
67
+ if files_ok or errors:
68
+ print()
69
+ print(colorize_text("════════════════════════════════════════", Fore.CYAN))
70
+ unique_files_with_errors = set(err.split('\t')[0] for err in errors)
71
+ print(colorize_text(
72
+ f"Correct files: {sum(1 for item in files_ok if item != '')}", Fore.GREEN))
73
+ print(colorize_text(
74
+ f"Files with errors: {sum(1 for item in unique_files_with_errors if item != '')}", Fore.RED))
75
+
76
+
77
+ def main():
78
+ parser = argparse.ArgumentParser(
79
+ description="Run norminette but better!")
80
+ parser.add_argument("filenames", nargs="*",
81
+ help="Space-separated filenames or shell pattern expansions like '*.c'. Supports all shell patterns.")
82
+ parser.add_argument("-a", "--args", nargs=argparse.REMAINDER,
83
+ help="Additional arguments for norminette.")
84
+ parser.add_argument("-e", "--error_only",
85
+ action="store_true", help="Display only errors.")
86
+ parser.add_argument("-s", "--summary_only",
87
+ action="store_true", help="Display only the summary.")
88
+ parser.add_argument("-d", "--detailed", action="store_true",
89
+ help="Display detailed error messages.")
90
+ args = parser.parse_args()
91
+ cmd = ["norminette"]
92
+ if args.filenames:
93
+ cmd.extend(args.filenames)
94
+ if args.args:
95
+ cmd.extend(args.args)
96
+ run_norminette(cmd, args.error_only, args.summary_only, args.detailed)
97
+
98
+
99
+ if __name__ == "__main__":
100
+ main()
normino-0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
normino-0.1/setup.py ADDED
@@ -0,0 +1,15 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name='normino',
5
+ version='0.1',
6
+ py_modules=['normino'],
7
+ install_requires=[
8
+ 'colorama',
9
+ ],
10
+ entry_points={
11
+ 'console_scripts': [
12
+ 'normino=normino:main',
13
+ ],
14
+ },
15
+ )