-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: stickyburp first commit new repo
- Loading branch information
0 parents
commit 2de74f2
Showing
34 changed files
with
66,347 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[*.{kt,kts}] | ||
indent_size=4 | ||
insert_final_newline=true | ||
max_line_length=120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Bug Report | ||
about: Create a report to help improve DOMspy | ||
title: '[BUG] ' | ||
labels: bug | ||
assignees: '' | ||
--- | ||
|
||
### Bug Description | ||
A clear and concise description of the bug. | ||
|
||
### Steps to Reproduce | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
### Expected Behavior | ||
A clear description of what you expected to happen. | ||
|
||
### Screenshots | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
### Environment | ||
- OS: [e.g. Windows 10, macOS 12.0] | ||
- Browser: [e.g. Chrome 96] | ||
- Extension Version: [e.g. 1.0.0] | ||
- URL being tested: [if applicable] | ||
|
||
### Additional Context | ||
Add any other context about the problem here. | ||
|
||
### Console Output | ||
``` | ||
Paste any relevant console output here | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: Feature Request | ||
about: Suggest an idea for DOMspy | ||
title: '[FEATURE] ' | ||
labels: enhancement | ||
assignees: '' | ||
--- | ||
|
||
### Problem Description | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
### Proposed Solution | ||
A clear and concise description of what you want to happen. | ||
|
||
### Alternative Solutions | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
### Use Case | ||
Describe how this feature would be used and who would use it. | ||
|
||
### Additional Context | ||
Add any other context, screenshots, or mock-ups about the feature request here. | ||
|
||
### Implementation Ideas | ||
If you have any thoughts on how this could be implemented, share them here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
version: 2 | ||
updates: | ||
# Gradle dependencies | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "monday" | ||
open-pull-requests-limit: 10 | ||
target-branch: "main" | ||
labels: | ||
- "dependencies" | ||
- "gradle" | ||
commit-message: | ||
prefix: "chore(deps)" | ||
include: "scope" | ||
ignore: | ||
# Ignore patch updates for stable dependencies | ||
- dependency-name: "*" | ||
update-types: ["version-update:semver-patch"] | ||
groups: | ||
# Group all kotlin related updates together | ||
kotlin-ecosystem: | ||
patterns: | ||
- "org.jetbrains.kotlin*" | ||
- "com.pinterest.ktlint" | ||
- "io.gitlab.arturbosch.detekt" | ||
|
||
# GitHub Actions dependencies | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "monday" | ||
open-pull-requests-limit: 10 | ||
labels: | ||
- "dependencies" | ||
- "github-actions" | ||
commit-message: | ||
prefix: "chore(ci)" | ||
include: "scope" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
### Kotlin ### | ||
*.class | ||
*.log | ||
*.ctxt | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
hs_err_pid* | ||
replay_pid* | ||
|
||
# Kotlin specific | ||
*.kotlin_module | ||
*.kotlin_metadata | ||
*.kotlin_builtins | ||
|
||
### Gradle ### | ||
.gradle/ | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
.gradletasknamecache | ||
|
||
### IntelliJ IDEA ### | ||
.idea/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
!settings.json | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
*.code-workspace | ||
.history/ | ||
|
||
### Mac OS ### | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
Icon | ||
._* | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
### Windows ### | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
*.stackdump | ||
[Dd]esktop.ini | ||
$RECYCLE.BIN/ | ||
*.lnk | ||
|
||
### Linux ### | ||
*~ | ||
.fuse_hidden* | ||
.directory | ||
.Trash-* | ||
.nfs* | ||
|
||
### Project Specific ### | ||
# Local configuration file | ||
local.properties | ||
|
||
# Log Files | ||
logs/ | ||
*.log.* | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Test Reports | ||
test-results/ | ||
reports/ | ||
coverage/ | ||
|
||
# Temporary files | ||
tmp/ | ||
temp/ | ||
|
||
# Generated files | ||
generated/ | ||
*.generated.* | ||
|
||
# Secrets and credentials | ||
*.key | ||
*.pem | ||
*.p12 | ||
*.jks | ||
*.keystore | ||
secrets.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import re | ||
import sys | ||
from pathlib import Path | ||
from typing import List, Tuple | ||
|
||
|
||
class GitHubActionChecker: | ||
def __init__(self): | ||
# Pattern for actions with SHA-1 hashes (pinned) | ||
self.pinned_pattern = re.compile(r"uses:\s+([^@\s]+)@([a-f0-9]{40})") | ||
|
||
# Pattern for actions with version tags (unpinned) | ||
self.unpinned_pattern = re.compile( | ||
r"uses:\s+([^@\s]+)@(v\d+(?:\.\d+)*(?:-[a-zA-Z0-9]+(?:\.\d+)*)?)" | ||
) | ||
|
||
# Pattern for all uses statements | ||
self.all_uses_pattern = re.compile(r"uses:\s+([^@\s]+)@([^\s\n]+)") | ||
|
||
def get_line_numbers( | ||
self, content: str, pattern: re.Pattern | ||
) -> List[Tuple[str, int]]: | ||
"""Find matches with their line numbers.""" | ||
matches = [] | ||
for i, line in enumerate(content.splitlines(), 1): | ||
for match in pattern.finditer(line): | ||
matches.append((match.group(0), i)) | ||
return matches | ||
|
||
def check_file(self, file_path: str) -> bool: | ||
"""Check a single file for unpinned dependencies.""" | ||
try: | ||
content = Path(file_path).read_text() | ||
except Exception as e: | ||
print(f"\033[91mError reading file {file_path}: {e}\033[0m") | ||
return False | ||
|
||
# Get matches with line numbers | ||
pinned_matches = self.get_line_numbers(content, self.pinned_pattern) | ||
unpinned_matches = self.get_line_numbers(content, self.unpinned_pattern) | ||
all_matches = self.get_line_numbers(content, self.all_uses_pattern) | ||
|
||
print(f"\n\033[1m[=] Checking file: {file_path}\033[0m") | ||
|
||
# Print pinned dependencies | ||
if pinned_matches: | ||
print("\033[92m[+] Pinned:\033[0m") | ||
for match, line_num in pinned_matches: | ||
print(f" |- {match} \033[90m({file_path}:{line_num})\033[0m") | ||
|
||
# Track all found actions for validation | ||
found_actions = set() | ||
for match, _ in pinned_matches + unpinned_matches: | ||
action_name = self.pinned_pattern.match( | ||
match | ||
) or self.unpinned_pattern.match(match) | ||
if action_name: | ||
found_actions.add(action_name.group(1)) | ||
|
||
has_errors = False | ||
|
||
# Check for unpinned dependencies | ||
if unpinned_matches: | ||
has_errors = True | ||
print("\033[93m[!] Unpinned (using version tags):\033[0m") | ||
for match, line_num in unpinned_matches: | ||
print(f" |- {match} \033[90m({file_path}:{line_num})\033[0m") | ||
|
||
# Check for completely unpinned dependencies (no SHA or version) | ||
unpinned_without_hash = [ | ||
(match, line_num) | ||
for match, line_num in all_matches | ||
if not any(match in pinned[0] for pinned in pinned_matches) | ||
and not any(match in unpinned[0] for unpinned in unpinned_matches) | ||
] | ||
|
||
if unpinned_without_hash: | ||
has_errors = True | ||
print("\033[91m[!] Completely unpinned (no SHA or version):\033[0m") | ||
for match, line_num in unpinned_without_hash: | ||
print( | ||
f" |- {match} \033[90m({self.format_terminal_link(file_path, line_num)})\033[0m" | ||
) | ||
|
||
# Print summary | ||
total_actions = ( | ||
len(pinned_matches) + len(unpinned_matches) + len(unpinned_without_hash) | ||
) | ||
if total_actions == 0: | ||
print("\033[93m[!] No GitHub Actions found in this file\033[0m") | ||
else: | ||
print("\n\033[1mSummary:\033[0m") | ||
print(f"Total actions: {total_actions}") | ||
print(f"Pinned: {len(pinned_matches)}") | ||
print(f"Unpinned with version: {len(unpinned_matches)}") | ||
print(f"Completely unpinned: {len(unpinned_without_hash)}") | ||
|
||
return not has_errors | ||
|
||
|
||
def main(): | ||
checker = GitHubActionChecker() | ||
files_to_check = sys.argv[1:] | ||
|
||
if not files_to_check: | ||
print("\033[91mError: No files provided to check\033[0m") | ||
print("Usage: python script.py <file1> <file2> ...") | ||
sys.exit(1) | ||
|
||
results = {file: checker.check_file(file) for file in files_to_check} | ||
|
||
# Print final summary | ||
print("\n\033[1mFinal Results:\033[0m") | ||
for file, passed in results.items(): | ||
status = "\033[92m✓ Passed\033[0m" if passed else "\033[91m✗ Failed\033[0m" | ||
print(f"{status} {file}") | ||
|
||
if not all(results.values()): | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.