* [PATCH 0/2] Align guest dependencies with their corresponding workflows
@ 2025-07-24 18:34 Daniel Gomez
2025-07-24 18:34 ` [PATCH 1/2] kconfig: add workflow dependencies for SMBD and KRB5 services Daniel Gomez
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Daniel Gomez @ 2025-07-24 18:34 UTC (permalink / raw)
To: Luis Chamberlain, Chuck Lever, Scott Mayhew, Jeff Layton
Cc: kdevops, Daniel Gomez
Several guest services (krb5, kdc, smbd, iscsi, nfsd) are missing from
various host workflow template files, creating kconfig configuration
inconsistencies. This occurs when workflows either lack implementation
support for these services or have no functional dependency on them.
This patch series ensures kconfig options accurately reflect the
services actually available in each workflow template.
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Daniel Gomez (2):
kconfig: add workflow dependencies for SMBD and KRB5 services
kconfig: add workflow dependencies for NFSD and iSCSI services
kconfigs/Kconfig.iscsi | 4 ++++
kconfigs/Kconfig.krb5 | 1 +
kconfigs/Kconfig.nfsd | 4 ++++
kconfigs/Kconfig.smbd | 1 +
4 files changed, 10 insertions(+)
---
base-commit: f9425cb01ef085cbabdf7c7cb0c5dfbc189f5a45
change-id: 20250724-fixes-6d1460cd1940
Best regards,
--
Daniel Gomez <da.gomez@samsung.com>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/2] kconfig: add workflow dependencies for SMBD and KRB5 services 2025-07-24 18:34 [PATCH 0/2] Align guest dependencies with their corresponding workflows Daniel Gomez @ 2025-07-24 18:34 ` Daniel Gomez 2025-07-24 18:34 ` [PATCH 2/2] kconfig: add workflow dependencies for NFSD and iSCSI services Daniel Gomez ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Daniel Gomez @ 2025-07-24 18:34 UTC (permalink / raw) To: Luis Chamberlain, Chuck Lever, Scott Mayhew, Jeff Layton Cc: kdevops, Daniel Gomez From: Daniel Gomez <da.gomez@samsung.com> Add workflow dependencies to KDEVOPS_SETUP_SMBD and KDEVOPS_SETUP_KRB5 to restrict their availability to compatible workflows. Both services are only supported in the fstests workflow based on host template analysis. This prevents configuration inconsistencies where services are enabled globally but not included in host generation for incompatible workflows. Generated-by: Claude AI Signed-off-by: Daniel Gomez <da.gomez@samsung.com> --- kconfigs/Kconfig.krb5 | 1 + kconfigs/Kconfig.smbd | 1 + 2 files changed, 2 insertions(+) diff --git a/kconfigs/Kconfig.krb5 b/kconfigs/Kconfig.krb5 index e590271..6fd196c 100644 --- a/kconfigs/Kconfig.krb5 +++ b/kconfigs/Kconfig.krb5 @@ -1,5 +1,6 @@ config KDEVOPS_SETUP_KRB5 bool "Set up KRB5" + depends on KDEVOPS_WORKFLOW_ENABLE_FSTESTS default n help Configure and bring up a MIT Kerberos V5 KDC. diff --git a/kconfigs/Kconfig.smbd b/kconfigs/Kconfig.smbd index b7c33d1..c132b13 100644 --- a/kconfigs/Kconfig.smbd +++ b/kconfigs/Kconfig.smbd @@ -1,6 +1,7 @@ # FIXME: need defaults for terraform hosts config KDEVOPS_SETUP_SMBD bool "Set up the Samba SMB server" + depends on KDEVOPS_WORKFLOW_ENABLE_FSTESTS default n help Configure and bring up the Samba SMB server. This will provision -- 2.50.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] kconfig: add workflow dependencies for NFSD and iSCSI services 2025-07-24 18:34 [PATCH 0/2] Align guest dependencies with their corresponding workflows Daniel Gomez 2025-07-24 18:34 ` [PATCH 1/2] kconfig: add workflow dependencies for SMBD and KRB5 services Daniel Gomez @ 2025-07-24 18:34 ` Daniel Gomez 2025-07-24 19:44 ` [PATCH 0/2] Align guest dependencies with their corresponding workflows Chuck Lever 2025-07-24 19:48 ` Luis Chamberlain 3 siblings, 0 replies; 10+ messages in thread From: Daniel Gomez @ 2025-07-24 18:34 UTC (permalink / raw) To: Luis Chamberlain, Chuck Lever, Scott Mayhew, Jeff Layton Cc: kdevops, Daniel Gomez From: Daniel Gomez <da.gomez@samsung.com> Add workflow dependencies to KDEVOPS_SETUP_NFSD and KDEVOPS_ENABLE_ISCSI to restrict their availability to compatible workflows. Both services are supported in fstests, pynfs, nfstest, and gitr workflows based on host template analysis. This ensures service configuration options are only available when the selected workflow can actually use them, preventing unused configurations and missing host groups. Generated-by: Claude AI Signed-off-by: Daniel Gomez <da.gomez@samsung.com> --- kconfigs/Kconfig.iscsi | 4 ++++ kconfigs/Kconfig.nfsd | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/kconfigs/Kconfig.iscsi b/kconfigs/Kconfig.iscsi index 2c40372..9401986 100644 --- a/kconfigs/Kconfig.iscsi +++ b/kconfigs/Kconfig.iscsi @@ -1,6 +1,10 @@ # FIXME: need defaults for terraform hosts menuconfig KDEVOPS_ENABLE_ISCSI bool "Set up an iSCSI target host" + depends on KDEVOPS_WORKFLOW_ENABLE_FSTESTS || \ + KDEVOPS_WORKFLOW_ENABLE_PYNFS || \ + KDEVOPS_WORKFLOW_ENABLE_NFSTEST || \ + KDEVOPS_WORKFLOW_ENABLE_GITR default n help Provision an additional target node as an iSCSI target. diff --git a/kconfigs/Kconfig.nfsd b/kconfigs/Kconfig.nfsd index 69fc9d2..8463e53 100644 --- a/kconfigs/Kconfig.nfsd +++ b/kconfigs/Kconfig.nfsd @@ -1,6 +1,10 @@ # FIXME: need defaults for terraform hosts config KDEVOPS_SETUP_NFSD bool "Set up the kernel nfs server" + depends on KDEVOPS_WORKFLOW_ENABLE_FSTESTS || \ + KDEVOPS_WORKFLOW_ENABLE_PYNFS || \ + KDEVOPS_WORKFLOW_ENABLE_NFSTEST || \ + KDEVOPS_WORKFLOW_ENABLE_GITR default n help Configure and bring up the kernel NFS server. This will provision -- 2.50.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-24 18:34 [PATCH 0/2] Align guest dependencies with their corresponding workflows Daniel Gomez 2025-07-24 18:34 ` [PATCH 1/2] kconfig: add workflow dependencies for SMBD and KRB5 services Daniel Gomez 2025-07-24 18:34 ` [PATCH 2/2] kconfig: add workflow dependencies for NFSD and iSCSI services Daniel Gomez @ 2025-07-24 19:44 ` Chuck Lever 2025-07-24 19:48 ` Luis Chamberlain 3 siblings, 0 replies; 10+ messages in thread From: Chuck Lever @ 2025-07-24 19:44 UTC (permalink / raw) To: Daniel Gomez, Luis Chamberlain, Scott Mayhew, Jeff Layton Cc: kdevops, Daniel Gomez On 7/24/25 2:34 PM, Daniel Gomez wrote: > Several guest services (krb5, kdc, smbd, iscsi, nfsd) are missing from > various host workflow template files, creating kconfig configuration > inconsistencies. This occurs when workflows either lack implementation > support for these services or have no functional dependency on them. > This patch series ensures kconfig options accurately reflect the > services actually available in each workflow template. > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com> > --- > Daniel Gomez (2): > kconfig: add workflow dependencies for SMBD and KRB5 services > kconfig: add workflow dependencies for NFSD and iSCSI services > > kconfigs/Kconfig.iscsi | 4 ++++ > kconfigs/Kconfig.krb5 | 1 + > kconfigs/Kconfig.nfsd | 4 ++++ > kconfigs/Kconfig.smbd | 1 + > 4 files changed, 10 insertions(+) > --- > base-commit: f9425cb01ef085cbabdf7c7cb0c5dfbc189f5a45 > change-id: 20250724-fixes-6d1460cd1940 > > Best regards, > -- > Daniel Gomez <da.gomez@samsung.com> > Reviewed-by: Chuck Lever <chuck.lever@oracle.com> -- Chuck Lever ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-24 18:34 [PATCH 0/2] Align guest dependencies with their corresponding workflows Daniel Gomez ` (2 preceding siblings ...) 2025-07-24 19:44 ` [PATCH 0/2] Align guest dependencies with their corresponding workflows Chuck Lever @ 2025-07-24 19:48 ` Luis Chamberlain 2025-07-25 7:33 ` Daniel Gomez 3 siblings, 1 reply; 10+ messages in thread From: Luis Chamberlain @ 2025-07-24 19:48 UTC (permalink / raw) To: Daniel Gomez Cc: Chuck Lever, Scott Mayhew, Jeff Layton, kdevops, Daniel Gomez On Thu, Jul 24, 2025 at 08:34:14PM +0200, Daniel Gomez wrote: > Several guest services (krb5, kdc, smbd, iscsi, nfsd) are missing from > various host workflow template files, creating kconfig configuration > inconsistencies. This occurs when workflows either lack implementation > support for these services or have no functional dependency on them. > This patch series ensures kconfig options accurately reflect the > services actually available in each workflow template. > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com> Looks good, just stylistic, I think its easier to just have Generated-by: Signed-off-by: Instead of: Generated-by: Signed-off-by: No point in the extra new line. Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Luis ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-24 19:48 ` Luis Chamberlain @ 2025-07-25 7:33 ` Daniel Gomez 2025-07-25 7:39 ` Luis Chamberlain 0 siblings, 1 reply; 10+ messages in thread From: Daniel Gomez @ 2025-07-25 7:33 UTC (permalink / raw) To: Luis Chamberlain Cc: Chuck Lever, Scott Mayhew, Jeff Layton, kdevops, Daniel Gomez On 24/07/2025 21.48, Luis Chamberlain wrote: > On Thu, Jul 24, 2025 at 08:34:14PM +0200, Daniel Gomez wrote: >> Several guest services (krb5, kdc, smbd, iscsi, nfsd) are missing from >> various host workflow template files, creating kconfig configuration >> inconsistencies. This occurs when workflows either lack implementation >> support for these services or have no functional dependency on them. >> This patch series ensures kconfig options accurately reflect the >> services actually available in each workflow template. >> >> Signed-off-by: Daniel Gomez <da.gomez@samsung.com> > > Looks good, just stylistic, I think its easier to just have > > Generated-by: > Signed-off-by: > > Instead of: > > Generated-by: > > Signed-off-by: > > No point in the extra new line. For that, I think it's better to update CLAUDE.md to be consistent. This is what it generated: docs: update commit message format for Claude AI Clarify the standard format for commits generated by Claude AI to ensure consistent tagging across the project. The format specifies that the Generated-by tag should precede the Signed-off-by tag with no blank lines between them. Generated-by: Claude AI Signed-off-by: Daniel Gomez <da.gomez@samsung.com> diff --git a/CLAUDE.md b/CLAUDE.md index 8bee7c0..4018f52 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -206,10 +206,16 @@ any spell fixes unless asked explicitly to do that. We want to use the Signed-off-by tag which embodies the application of the Developer Certificate or Origin. -## Use Generated-by: Claude AI +## Commit Message Format -Use this tag for code generated by Claude code AI. Put this before the -Signed-off-by tag. +For all commits generated by Claude AI, use the following format: + +``` +Generated-by: Claude AI +Signed-off-by: <author> +``` + +The `Generated-by:` tag should always precede the `Signed-off-by:` tag with no blank lines between them. ## Prompt Examples > > Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Thanks! > > Luis ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-25 7:33 ` Daniel Gomez @ 2025-07-25 7:39 ` Luis Chamberlain 2025-07-25 8:09 ` Daniel Gomez 0 siblings, 1 reply; 10+ messages in thread From: Luis Chamberlain @ 2025-07-25 7:39 UTC (permalink / raw) To: Daniel Gomez Cc: Chuck Lever, Scott Mayhew, Jeff Layton, kdevops, Daniel Gomez On Fri, Jul 25, 2025 at 09:33:52AM +0200, Daniel Gomez wrote: > > > On 24/07/2025 21.48, Luis Chamberlain wrote: > > On Thu, Jul 24, 2025 at 08:34:14PM +0200, Daniel Gomez wrote: > >> Several guest services (krb5, kdc, smbd, iscsi, nfsd) are missing from > >> various host workflow template files, creating kconfig configuration > >> inconsistencies. This occurs when workflows either lack implementation > >> support for these services or have no functional dependency on them. > >> This patch series ensures kconfig options accurately reflect the > >> services actually available in each workflow template. > >> > >> Signed-off-by: Daniel Gomez <da.gomez@samsung.com> > > > > Looks good, just stylistic, I think its easier to just have > > > > Generated-by: > > Signed-off-by: > > > > Instead of: > > > > Generated-by: > > > > Signed-off-by: > > > > No point in the extra new line. > > For that, I think it's better to update CLAUDE.md to be consistent. This is what > it generated: > > docs: update commit message format for Claude AI My testing showed that was not enough. Also the white space noise is a pain. How about: From 3dca57c647d12c7fe437cb2d439cb3b0440f53f8 Mon Sep 17 00:00:00 2001 From: Luis Chamberlain <mcgrof@kernel.org> Date: Thu, 24 Jul 2025 20:41:15 -0700 Subject: [PATCH] Makefile: add make style for style checking Add a 'make style' which helps humans and bots follow some sensible coding conventions. - Add scripts/detect_whitespace_issues.py check for white space eye sores - Add scripts/check_commit_format.py to validate Generated-by and the Signed-off-by spacing - Add scripts/fix_whitespace_issues.py to help with stupid spacing eyesores - Update CLAUDE.md to ensure it runs 'make style' Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- CLAUDE.md | 61 +++++++++++++ Makefile | 5 + kdevops-ci | 1 + scripts/check_commit_format.py | 85 +++++++++++++++++ scripts/detect_whitespace_issues.py | 109 ++++++++++++++++++++++ scripts/fix_whitespace_issues.py | 137 ++++++++++++++++++++++++++++ 6 files changed, 398 insertions(+) create mode 160000 kdevops-ci create mode 100755 scripts/check_commit_format.py create mode 100755 scripts/detect_whitespace_issues.py create mode 100755 scripts/fix_whitespace_issues.py diff --git a/CLAUDE.md b/CLAUDE.md index 8bee7c0852c2..ea7c0fffd366 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -89,6 +89,7 @@ make help # Show available targets make V=1 [target] # Verbose build output make AV=1-6 [target] # Ansible verbose output (levels 0-6) make dynconfig # Generate dynamic configuration +make style # Check for whitespace issues - ALWAYS run before completing work make mrproper # Clean everything and restart from scratch ``` @@ -211,6 +212,66 @@ Developer Certificate or Origin. Use this tag for code generated by Claude code AI. Put this before the Signed-off-by tag. +**CRITICAL FORMATTING RULE**: When using "Generated-by: Claude AI", it MUST be +immediately followed by the "Signed-off-by:" tag with NO empty lines between them. +These two lines must be consecutive. + +Correct format: +``` +Subject line + +Detailed description of changes... + +Generated-by: Claude AI +Signed-off-by: Your Name <email@example.com> +``` + +**WRONG** - Do NOT add empty lines between Generated-by and Signed-off-by: +``` +Generated-by: Claude AI + +Signed-off-by: Your Name <email@example.com> +``` + +**WRONG** - Do NOT add extra empty lines: +``` +Generated-by: Claude AI + + +Signed-off-by: Your Name <email@example.com> +``` + +## Code Quality Requirements + +**IMPORTANT**: Before completing any work, you MUST run `make style` to check for +both whitespace issues and commit message formatting. This ensures code consistency +and prevents formatting issues from being introduced into the codebase. + +The style checker will identify: +- Trailing whitespace +- Mixed tabs and spaces +- Files without newlines at EOF +- Other whitespace-related issues +- Incorrect commit message formatting (Generated-by/Signed-off-by spacing) + +Fix all reported issues before submitting your work. The `make style` command +checks both file whitespace and the most recent commit message format. + +### Automatic Whitespace Fixing + +For convenience, you can automatically fix whitespace issues using: +```bash +python3 scripts/fix_whitespace_issues.py # Fix all modified files +python3 scripts/fix_whitespace_issues.py file1 file2 # Fix specific files +``` + +The fixer script will: +- Remove trailing whitespace from lines +- Add missing newlines at end of files +- Reduce excessive blank lines to maximum 2 consecutive + +Always run `make style` after using the fixer to verify all issues are resolved. + ## Prompt Examples Refer to PROMPTS.md for example set of prompts used to generate code on diff --git a/Makefile b/Makefile index c6a5c321f8df..bfff8f90b3f1 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,11 @@ include scripts/ci.Makefile include scripts/archive.Makefile include scripts/defconfig.Makefile +PHONY += style +style: + $(Q)python3 scripts/detect_whitespace_issues.py + $(Q)python3 scripts/check_commit_format.py + PHONY += clean clean: $(Q)$(MAKE) -f scripts/build.Makefile $@ diff --git a/kdevops-ci b/kdevops-ci new file mode 160000 index 000000000000..812060752af0 --- /dev/null +++ b/kdevops-ci @@ -0,0 +1 @@ +Subproject commit 812060752af00e601add5716c3180fbb21c41784 diff --git a/scripts/check_commit_format.py b/scripts/check_commit_format.py new file mode 100755 index 000000000000..f72f9d1a0352 --- /dev/null +++ b/scripts/check_commit_format.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +""" +Commit Message Format Checker for kdevops + +This script checks the most recent commit message for proper formatting: +- If "Generated-by: Claude AI" is present, it must be immediately followed by + "Signed-off-by:" with no blank lines in between +""" + +import subprocess +import sys +import re + +def get_latest_commit_message(): + """Get the latest commit message""" + try: + result = subprocess.run(['git', 'log', '-1', '--pretty=format:%B'], + capture_output=True, text=True, check=True) + return result.stdout + except subprocess.CalledProcessError: + print("Error: Failed to get commit message") + return None + except FileNotFoundError: + print("Error: git command not found") + return None + +def check_commit_format(commit_msg): + """Check commit message formatting""" + issues = [] + if not commit_msg: + return ["No commit message found"] + lines = commit_msg.strip().split('\n') + # Find Generated-by line + generated_by_idx = None + signed_off_by_idx = None + for i, line in enumerate(lines): + if line.startswith('Generated-by: Claude AI'): + generated_by_idx = i + elif line.startswith('Signed-off-by:'): + signed_off_by_idx = i + # If Generated-by is present, check formatting + if generated_by_idx is not None: + if signed_off_by_idx is None: + issues.append("Generated-by: Claude AI found but no Signed-off-by tag present") + else: + # Check if Generated-by is immediately followed by Signed-off-by (no lines in between) + if signed_off_by_idx != generated_by_idx + 1: + lines_between = signed_off_by_idx - generated_by_idx - 1 + if lines_between > 0: + issues.append(f"Generated-by: Claude AI must be immediately followed by Signed-off-by (found {lines_between} lines between them)") + for i in range(generated_by_idx + 1, signed_off_by_idx): + if lines[i].strip(): + issues.append(f" - Non-empty line at {i+1}: '{lines[i]}'") + else: + issues.append(f" - Empty line at {i+1}") + return issues + +def main(): + """Main function to check commit message format""" + commit_msg = get_latest_commit_message() + if commit_msg is None: + return 1 + issues = check_commit_format(commit_msg) + if issues: + print("❌ Commit message formatting issues found:") + for issue in issues: + print(f" ⚠️ {issue}") + print("\nLatest commit message:") + print("=" * 50) + print(commit_msg) + print("=" * 50) + print("\nCorrect format when using Generated-by:") + print("Subject line") + print("") + print("Detailed description...") + print("") + print("Generated-by: Claude AI") + print("Signed-off-by: Your Name <email@example.com>") + return 1 + else: + print("✅ Commit message formatting is correct!") + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/scripts/detect_whitespace_issues.py b/scripts/detect_whitespace_issues.py new file mode 100755 index 000000000000..165a33e25bcb --- /dev/null +++ b/scripts/detect_whitespace_issues.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +""" +Whitespace Issue Detector for kdevops + +This script detects common whitespace issues that Claude AI tends to introduce: +- Trailing whitespace at end of lines +- Missing newline at end of file +- Excessive blank lines +""" + +import os +import sys +from pathlib import Path + +def check_file_whitespace(file_path): + """Check a single file for whitespace issues""" + issues = [] + + try: + with open(file_path, 'rb') as f: + content = f.read() + + # Skip binary files + if b'\0' in content: + return issues + + lines = content.decode('utf-8', errors='ignore').splitlines(keepends=True) + + # Check trailing whitespace + for line_num, line in enumerate(lines, 1): + if line.rstrip('\n\r').endswith(' ') or line.rstrip('\n\r').endswith('\t'): + issues.append(f"Line {line_num}: Trailing whitespace") + + # Check missing newline at end of file + if content and not content.endswith(b'\n'): + issues.append("Missing newline at end of file") + + # Check for excessive blank lines (more than 2 consecutive) + blank_count = 0 + for line_num, line in enumerate(lines, 1): + if line.strip() == '': + blank_count += 1 + else: + if blank_count > 2: + issues.append(f"Line {line_num - blank_count}: {blank_count} consecutive blank lines") + blank_count = 0 + + except Exception as e: + issues.append(f"Error reading file: {e}") + + return issues + +def main(): + """Main function to scan for whitespace issues""" + if len(sys.argv) > 1: + paths = sys.argv[1:] + else: + # Default to git tracked files with modifications + import subprocess + try: + result = subprocess.run(['git', 'diff', '--name-only'], + capture_output=True, text=True, check=True) + paths = result.stdout.strip().split('\n') if result.stdout.strip() else [] + if not paths: + print("No modified files found in git") + return + except subprocess.CalledProcessError: + print("Error: Not in a git repository or git command failed") + return + except FileNotFoundError: + print("Error: git command not found") + return + + total_issues = 0 + files_with_issues = 0 + + for path_str in paths: + path = Path(path_str) + if not path.exists(): + print(f"Warning: {path} does not exist") + continue + + if path.is_file(): + # Skip certain file types + if path.suffix in ['.pyc', '.so', '.o', '.bin', '.jpg', '.png', '.gif']: + continue + + issues = check_file_whitespace(path) + if issues: + files_with_issues += 1 + total_issues += len(issues) + print(f"\n{path}:") + for issue in issues: + print(f" ⚠️ {issue}") + + print(f"\nSummary: {total_issues} whitespace issues found in {files_with_issues} files") + + if total_issues > 0: + print("\nTo fix these issues:") + print("- Remove trailing spaces/tabs from lines") + print("- Add newline at end of files") + print("- Reduce excessive blank lines to 1-2 maximum") + return 1 + else: + print("✅ No whitespace issues found!") + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/scripts/fix_whitespace_issues.py b/scripts/fix_whitespace_issues.py new file mode 100755 index 000000000000..3e69ea5082ba --- /dev/null +++ b/scripts/fix_whitespace_issues.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python3 +""" +Whitespace Issue Fixer for kdevops + +This script fixes common whitespace issues that Claude AI tends to introduce: +- Trailing whitespace at end of lines +- Missing newline at end of file +- Excessive blank lines (reduces to maximum 2 consecutive) +""" + +import os +import sys +from pathlib import Path + +def fix_file_whitespace(file_path): + """Fix whitespace issues in a single file""" + issues_fixed = [] + + try: + with open(file_path, 'rb') as f: + content = f.read() + + # Skip binary files + if b'\0' in content: + return issues_fixed + + original_content = content.decode('utf-8', errors='ignore') + lines = original_content.splitlines(keepends=True) + modified = False + + # Fix trailing whitespace + new_lines = [] + for line_num, line in enumerate(lines, 1): + original_line = line + # Remove trailing whitespace but preserve line endings + if line.endswith('\r\n'): + cleaned_line = line.rstrip(' \t\r\n') + '\r\n' + elif line.endswith('\n'): + cleaned_line = line.rstrip(' \t\n') + '\n' + else: + cleaned_line = line.rstrip(' \t') + + if original_line != cleaned_line: + issues_fixed.append(f"Line {line_num}: Removed trailing whitespace") + modified = True + + new_lines.append(cleaned_line) + + # Fix excessive blank lines (reduce to maximum 2 consecutive) + final_lines = [] + blank_count = 0 + i = 0 + while i < len(new_lines): + line = new_lines[i] + if line.strip() == '': + blank_count += 1 + if blank_count <= 2: + final_lines.append(line) + else: + issues_fixed.append(f"Line {i+1}: Removed excessive blank line") + modified = True + else: + blank_count = 0 + final_lines.append(line) + i += 1 + + # Fix missing newline at end of file + new_content = ''.join(final_lines) + if new_content and not new_content.endswith('\n'): + new_content += '\n' + issues_fixed.append("Added missing newline at end of file") + modified = True + + # Write back if modified + if modified: + with open(file_path, 'w', encoding='utf-8') as f: + f.write(new_content) + + except Exception as e: + issues_fixed.append(f"Error processing file: {e}") + + return issues_fixed + +def main(): + """Main function to fix whitespace issues""" + if len(sys.argv) > 1: + paths = sys.argv[1:] + else: + # Default to git tracked files with modifications + import subprocess + try: + result = subprocess.run(['git', 'diff', '--name-only'], + capture_output=True, text=True, check=True) + paths = result.stdout.strip().split('\n') if result.stdout.strip() else [] + if not paths: + print("No modified files found in git") + return 0 + except subprocess.CalledProcessError: + print("Error: Not in a git repository or git command failed") + return 1 + except FileNotFoundError: + print("Error: git command not found") + return 1 + + total_fixes = 0 + files_fixed = 0 + + for path_str in paths: + path = Path(path_str) + if not path.exists(): + print(f"Warning: {path} does not exist") + continue + + if path.is_file(): + # Skip certain file types + if path.suffix in ['.pyc', '.so', '.o', '.bin', '.jpg', '.png', '.gif']: + continue + + fixes = fix_file_whitespace(path) + if fixes: + files_fixed += 1 + total_fixes += len(fixes) + print(f"\n{path}:") + for fix in fixes: + print(f" ✅ {fix}") + + print(f"\nSummary: {total_fixes} whitespace issues fixed in {files_fixed} files") + + if total_fixes > 0: + print("✅ Whitespace issues have been automatically fixed!") + return 0 + else: + print("✅ No whitespace issues found to fix!") + return 0 + +if __name__ == '__main__': + sys.exit(main()) -- 2.45.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-25 7:39 ` Luis Chamberlain @ 2025-07-25 8:09 ` Daniel Gomez 2025-07-25 8:15 ` Luis Chamberlain 0 siblings, 1 reply; 10+ messages in thread From: Daniel Gomez @ 2025-07-25 8:09 UTC (permalink / raw) To: Luis Chamberlain Cc: Chuck Lever, Scott Mayhew, Jeff Layton, kdevops, Daniel Gomez On 25/07/2025 09.39, Luis Chamberlain wrote: > On Fri, Jul 25, 2025 at 09:33:52AM +0200, Daniel Gomez wrote: >> >> >> On 24/07/2025 21.48, Luis Chamberlain wrote: >>> On Thu, Jul 24, 2025 at 08:34:14PM +0200, Daniel Gomez wrote: >>>> Several guest services (krb5, kdc, smbd, iscsi, nfsd) are missing from >>>> various host workflow template files, creating kconfig configuration >>>> inconsistencies. This occurs when workflows either lack implementation >>>> support for these services or have no functional dependency on them. >>>> This patch series ensures kconfig options accurately reflect the >>>> services actually available in each workflow template. >>>> >>>> Signed-off-by: Daniel Gomez <da.gomez@samsung.com> >>> >>> Looks good, just stylistic, I think its easier to just have >>> >>> Generated-by: >>> Signed-off-by: >>> >>> Instead of: >>> >>> Generated-by: >>> >>> Signed-off-by: >>> >>> No point in the extra new line. >> >> For that, I think it's better to update CLAUDE.md to be consistent. This is what >> it generated: >> >> docs: update commit message format for Claude AI > > My testing showed that was not enough. Also the white space noise is a I pushed it already. Sorry about that as the patch has the blank space. > pain. How about: > From 3dca57c647d12c7fe437cb2d439cb3b0440f53f8 Mon Sep 17 00:00:00 2001 > From: Luis Chamberlain <mcgrof@kernel.org> > Date: Thu, 24 Jul 2025 20:41:15 -0700 > Subject: [PATCH] Makefile: add make style for style checking > > Add a 'make style' which helps humans and bots follow some sensible > coding conventions. > > - Add scripts/detect_whitespace_issues.py check for white space eye sores > - Add scripts/check_commit_format.py to validate Generated-by and the > Signed-off-by spacing > - Add scripts/fix_whitespace_issues.py to help with stupid spacing > eyesores > - Update CLAUDE.md to ensure it runs 'make style' This is pretty much like kdevops version of the "scripts/checkpatch.pl" in the kernel, right? Well, a first simple version of it and integrated in Claude Code to be executed after commits. So, I was looking into having something like checkpatch some time ago. Now, with this generative AI there's no reason to wait. So I think it's a good idea to go with that. But it's missing b4 integration. "b4 prep --check" for the kernel runs checkpatch like this [1]: ./scripts/checkpatch.pl --terse --no-summary --mailback --showfile. Link: https://b4.docs.kernel.org/en/latest/contributor/prep.html#checking-your-work [1] We just extend the .b4-config to customize it for kdevops: [b4] prep-perpatch-check-cmd = make style I know this is Claude Code vs manual patches. I think both paths need to run the same scripts. I'd like the check step to also do more things like running Ansible lint as discussed here [2]: Link: https://lore.kernel.org/kdevops/gbpb6kxm5bh4xix2otgo5by5ubuv6jyezhtrfzdtltbzxv2niw@vcnlebdwqclr/ [2] In this branch [3] I was experimenting with pre-commit and spellcheck on GH CI: 6668fedb95fc github/workflows/fstests.yml: add pre-commit codespell support ccb55f87121b pre-commit: codespell: update v2.2.5 -> v2.4.1 cc27e2df77ae pre-commit: fix lint indentation warnings Link: https://github.com/dkruces/kdevops/commits/dagomez/next/ [3] I've lost the Ansible lint experiments but they were similar to codespell. Adding support for these would be great in the check path. But running that only for the changes was the "trickiest" part. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-25 8:09 ` Daniel Gomez @ 2025-07-25 8:15 ` Luis Chamberlain 2025-07-25 13:45 ` Daniel Gomez 0 siblings, 1 reply; 10+ messages in thread From: Luis Chamberlain @ 2025-07-25 8:15 UTC (permalink / raw) To: Daniel Gomez Cc: Chuck Lever, Scott Mayhew, Jeff Layton, kdevops, Daniel Gomez On Fri, Jul 25, 2025 at 1:09 AM Daniel Gomez <da.gomez@kernel.org> wrote: > So, I was looking into having something like checkpatch some time ago. Now, with > this generative AI there's no reason to wait. So I think it's a good idea to > go with that. But it's missing b4 integration. "b4 prep --check" for the kernel > runs checkpatch like this [1]: Sounds good. This patch was just in another series I have but if its useful I figured I'd send it out. So no worries. But if you're going to extend it with more stuff, if you can pick it up and extend it that'd be neat as then I can just remove that from my future queue of patches to post. I gather at this point this is just going to be normal for us to use these tools to grow kdevops and so the sooner we have sanity checks the better. Could you pick up this patch and amend it with the ideas you have too? Then I'll just carry it locally until you push it out and I can then ignore this patch later? Luis ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] Align guest dependencies with their corresponding workflows 2025-07-25 8:15 ` Luis Chamberlain @ 2025-07-25 13:45 ` Daniel Gomez 0 siblings, 0 replies; 10+ messages in thread From: Daniel Gomez @ 2025-07-25 13:45 UTC (permalink / raw) To: Luis Chamberlain Cc: Chuck Lever, Scott Mayhew, Jeff Layton, kdevops, Daniel Gomez On 25/07/2025 10.15, Luis Chamberlain wrote: > On Fri, Jul 25, 2025 at 1:09 AM Daniel Gomez <da.gomez@kernel.org> wrote: > >> So, I was looking into having something like checkpatch some time ago. Now, with >> this generative AI there's no reason to wait. So I think it's a good idea to >> go with that. But it's missing b4 integration. "b4 prep --check" for the kernel >> runs checkpatch like this [1]: > > Sounds good. This patch was just in another series I have but if its > useful I figured I'd send it out. So no worries. But if you're going > to extend it with more stuff, if you can pick it up and extend it > that'd be neat as then I can just remove that from my future queue of > patches to post. I gather at this point this is just going to be > normal for us to use these tools to grow kdevops and so the sooner we > have sanity checks the better. Could you pick up this patch and amend > it with the ideas you have too? Then I'll just carry it locally until > you push it out and I can then ignore this patch later? Pushed it to my kdevops fork: https://github.com/dkruces/kdevops/tree/b4/checkpatch I'll play soon with Claude Code to run local checks for patches and see how far we can go. > > Luis ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-07-25 13:45 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-07-24 18:34 [PATCH 0/2] Align guest dependencies with their corresponding workflows Daniel Gomez 2025-07-24 18:34 ` [PATCH 1/2] kconfig: add workflow dependencies for SMBD and KRB5 services Daniel Gomez 2025-07-24 18:34 ` [PATCH 2/2] kconfig: add workflow dependencies for NFSD and iSCSI services Daniel Gomez 2025-07-24 19:44 ` [PATCH 0/2] Align guest dependencies with their corresponding workflows Chuck Lever 2025-07-24 19:48 ` Luis Chamberlain 2025-07-25 7:33 ` Daniel Gomez 2025-07-25 7:39 ` Luis Chamberlain 2025-07-25 8:09 ` Daniel Gomez 2025-07-25 8:15 ` Luis Chamberlain 2025-07-25 13:45 ` Daniel Gomez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox