Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shamy #2

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added cli/LP Github repos.xlsx
Binary file not shown.
74 changes: 49 additions & 25 deletions cli/analyser.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,60 @@
from config import Config as c

# Check if the Excel file exists
workbook = c.load_or_create_workbook('LP Github repos.xlsx')

# Select the 'LP Github repos' sheet or create it if it doesn't exist
sheet_name = 'LP Github repos'
sheet = c.select_or_create_sheet(workbook, sheet_name)

# Define the headers in the first row of the sheet if it's a new sheet
if sheet.max_row == 1:
headers = [
'Repository Name',
'Package Manager',
'Dependency Management',
'Semantic Release',
'GHA',
'Integration Suite (GHA)',
'Concurrency Rule (GHA)',
'Mend (GHA)'
]

# Write the headers to the sheet
c.write_headers(sheet, headers)

# Analyze each repository
for repo in c.repos:
# Analyse the repository
try:
# Clone the repo
# Analyze the repository
c.clone_repo(repo)
package_manager = c.get_package_manager(repo)
dependency_management = c.get_dependency_management(repo)
semantic_release = c.get_semantic_release(repo)
gha = c.get_gha(repo)
integration_suite = c.get_gha_integration(repo)
concurrency_rule = c.get_gha_concurrency(repo)
mend_gha = c.get_mend_gha(repo)
c.return_to_root(repo)

# Check for a Package Manager
packageManager = c.get_package_manager(repo)
# Check if the repository already exists in the sheet
repo_exists = False
for row in range(2, sheet.max_row + 1):
if sheet.cell(row=row, column=1).value == repo:
repo_exists = True
break

# Check for Semantic Release
semanticRelease = c.get_semantic_release(repo)
# Update the data if the repository already exists, or add a new row otherwise
c.update_or_add_repo(sheet, repo, repo_exists, package_manager, dependency_management, semantic_release, gha, integration_suite, concurrency_rule, mend_gha)

# Check for GitHub Actions
githubActions = c.get_gha(repo)

# Return to the root directory and delete the repo
c.return_to_root(repo)
except:
print(f'Failed to analyse {repo}.')
print('Exiting program.')
exit()
# Save the modified workbook
workbook.save('LP Github repos.xlsx')

# Print the repository information
c.console_output(repo, package_manager, semantic_release, gha, dependency_management, integration_suite,
concurrency_rule, mend_gha)

# Print the repository information to the console
try:
print('--------------------------------')
print(f'Repository: {repo}')
print(f'Package Manager: {packageManager}')
print(f'Semantic Release: {semanticRelease}')
print(f'GitHub Actions: {githubActions}')
print('--------------------------------')
except:
print(f'Failed to print to the console for {repo}.')
print(f'{c.RED}Failed to analyze {repo}.{c.RESET}')
print('Exiting program.')
exit()
exit()
Loading