Showing 49 of 129 total issues
File bear_export_sync.py
has 540 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# encoding=utf-8
# python3.6
# bear_export_sync.py
# Developed with Visual Studio Code with MS Python Extension.
File bear_export_sync.py
has 538 lines of code (exceeds 250 allowed). Consider refactoring. Open
# encoding=utf-8
# python3.6
# bear_export_sync.py
# Developed with Visual Studio Code with MS Python Extension.
Function main
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
func main() {
if listAllFans {
// List all fans and exit
os.Exit(0)
}
- 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 sub_path_from_tag
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def sub_path_from_tag(temp_path, filename, md_text):
# Get tags in note:
pattern1 = r'(?<!\S)\#([.\w\/\-]+)[ \n]?(?!([\/ \w]+\w[#]))'
pattern2 = r'(?<![\S])\#([^ \d][.\w\/ ]+?)\#([ \n]|$)'
if multi_tag_folders:
- 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 sub_path_from_tag
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def sub_path_from_tag(temp_path, filename, md_text):
# Get tags in note:
# pattern1 = r'(?<!\S)\#([.\w\/\-]+)[ \n]?(?!([\/ \w]+\w[#]))' # Tags without spaces
# the same as above, but ignores tags less than 3 characters long and tags that don't start with a letter
pattern1 = r'(?<!\S)\#([a-zA-Z][.\w\/\-]{2,})[ \n]?(?!([\/ \w]+\w[#]))'
- 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 main
has 136 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
if listAllFans {
// List all fans and exit
os.Exit(0)
}
Function printOutput
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def printOutput(stats):
"""
Print statistics output with or without Curses
"""
head = " Average statistics, interval %s seconds " % args.interval
- 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 main
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def main():
"""
Main entrance
* get stats in the loop
"""
- 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 sync_md_updates
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def sync_md_updates():
updates_found = False
if not os.path.exists(sync_ts_file) or not os.path.exists(export_ts_file):
return False
ts_last_sync = os.path.getmtime(sync_ts_file)
- 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 sync_md_updates
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def sync_md_updates():
updates_found = False
if not os.path.exists(sync_ts_file) or not os.path.exists(export_ts_file):
return False
ts_last_sync = os.path.getmtime(sync_ts_file)
- 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 move_to_root_folder
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def move_to_root_folder(root_path, cur_path):
for filename in os.listdir(cur_path):
if os.path.isfile(os.path.join(cur_path, filename)):
# if the file already exists, overwrite it
if os.path.isfile(os.path.join(root_path, filename)):
- 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 export_markdown
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def export_markdown():
with sqlite3.connect(bear_db) as conn:
conn.row_factory = sqlite3.Row
query = "SELECT * FROM `ZSFNOTE` WHERE `ZTRASHED` LIKE '0' AND `ZARCHIVED` LIKE '0'"
c = conn.execute(query)
- 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 export_markdown
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def export_markdown():
with sqlite3.connect(bear_db) as conn:
conn.row_factory = sqlite3.Row
query = "SELECT * FROM `ZSFNOTE` WHERE `ZTRASHED` LIKE '0' AND `ZARCHIVED` LIKE '0'"
c = conn.execute(query)
- 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 init
has 97 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
// Initialize the logger
logger = log.New(os.Stdout, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile)
flag.StringVar(&fanPath, "fanpath", "/sys/class/hwmon/hwmon4/pwm3", "Path to the PWM fan control")
Function select_calendar
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def select_calendar(prompt, default_calendar=None, match_string=None):
script = """
tell application "Calendar"
set matchingCalendars to {}
set calendarNames to {{}}
- 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
File glustertop.py
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""
Display gluster traffic
This tool uses gluster profiling feature, parsing cumulative statistics.
Function move_files
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def move_files(src_dir, dest_dir, dry_run=False):
"""Move all files from src_dir and its subdirectories to dest_dir, renaming
them to ensure that no two files have the same name. Returns a mapping of
old file names to new file names. If dry_run is True, the files will not
actually be moved.
- 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
File nv_fan_control.go
has 503 lines of code (exceeds 500 allowed). Consider refactoring. Open
// A simple tool that adjusts the fan speed of the GPU based on its temperature.
// Its designed for a custom cooler I have on my Nvidia Tesla P100 which is a 12v non-pwm fan.
// Author: Sam McLeod @sammcj
package main
Function update_markdown_links
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_markdown_links(markdown_dir, src_dir, dest_dir, file_mapping, strip_full_path=True, dry_run=False):
"""Update all image links in markdown files in markdown_dir (recursively)
using the provided file mapping. If dry_run is True, the links will not
actually be updated.
"""
- 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 get_tag_from_path
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_tag_from_path(md_text, md_file, root_path, inbox_for_root=True, extra_tag=''):
# extra_tag should be passed as '#tag' or '#space tag#'
path = md_file.replace(root_path, '')[1:]
sub_path = os.path.split(path)[0]
tags = []
- 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"