Showing 11 of 11 total issues
Function fetchRepos
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export async function fetchRepos(lang: string, sort: string) {
if (!API_KEY) {
throw new Error("You need to specify a GitHub PAT in the `GH_ACCESS_TOKEN` env var");
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fetchRepos
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function fetchRepos(lang: string, sort: string) {
if (!API_KEY) {
throw new Error("You need to specify a GitHub PAT in the `GH_ACCESS_TOKEN` env var");
}
File insert_contributor_content.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
This script generates markdown from the user-contributed YAML file,
enriched with data from the GitHub API, and inserts it into the readme.
Python 3.6+ is required
File validate_pr.py
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Assortment of checks run against new PRs, when git-in-here.yml is appended to
The script formats results into markdown, and posts as a comment on the PR
It checks:
- The YAML is still valid and parsable
Function build_markdown_content
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def build_markdown_content(
contributors: List[Dict[str, str]], stargazers: List[str]
) -> str:
"""
Use the content returned from the YAML + complimentary data (like stargazers),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function check_if_stargazer
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_if_stargazer(username) -> bool:
"""
Checks if a given user has starred the repository.
:param user: The username to check.
:return: Boolean indicating whether the user has starred the repo.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fetch_all_stargazers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def fetch_all_stargazers(
repo_owner: str, repo_name: str, access_token: Optional[str] = None
) -> List[str]:
"""
Fetches all stargazers of a given GitHub repository.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run_checks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run_checks(user, contributor_data, pr_body):
errors = []
if not user:
# If we don't have a user associated with the PR, we can't continue
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function handle_rate_limit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_rate_limit(response) -> None:
if response.status_code == 429 or response.status_code == 403:
try:
reset_time = int(response.headers.get('X-RateLimit-Reset'))
except ValueError:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return errors
Avoid too many return
statements within this function. Open
return errors