Showing 11 of 66 total issues
Function exports
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (ctx) {
return {
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://quasar.dev/quasar-cli/cli-documentation/boot-files
Method API.Upload
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (api *API) Upload(c *gin.Context) {
// parse and validate file and post parameters
form, err := c.MultipartForm()
if err != nil {
Method API.Upload
has 11 return statements (exceeds 4 allowed). Open
Open
func (api *API) Upload(c *gin.Context) {
// parse and validate file and post parameters
form, err := c.MultipartForm()
if err != nil {
Function unzip
has 8 return statements (exceeds 4 allowed). Open
Open
func unzip(src, dest string) error {
r, err := zip.OpenReader(src)
if err != nil {
return err
}
Function SeedTable
has 6 return statements (exceeds 4 allowed). Open
Open
func SeedTable(api *API, table, file string) (count int) {
switch table {
case "rates":
if api.rates.RateCount() > 0 {
logger.Log.Warn(fmt.Sprintf("- rates, file %s skipped, table contains %d records", file, api.rates.RateCount()))
Function getborderDays
has 5 return statements (exceeds 4 allowed). Open
Open
func getborderDays(year, month string) (days []string, err error) {
layout := "2006-1-02"
monthStart, err := time.Parse(layout, year+"-"+month+"-01")
if err != nil {
return nil, err
Function restoreDB
has 5 return statements (exceeds 4 allowed). Open
Open
func restoreDB(f *os.File) error {
// delete if target folder exists
err := os.RemoveAll(viper.GetString("uploadFolderTemp"))
if err != nil {
return err
Method ReportedRecordManager.ReportedRecordUpdate
has 5 return statements (exceeds 4 allowed). Open
Open
func (db *ReportedRecordManager) ReportedRecordUpdate(r UpdatedValue) ReportedRecord {
updateValue := UpdatedValue{
ID: r.ID,
Type: r.Type,
Value: r.Value,
Function export
has 5 return statements (exceeds 4 allowed). Open
Open
func export() (fileName string, err error) {
fileName = "timesheet-backup.zip"
db := ConnectDB()
defer db.Close()
exportFolder := viper.GetString("export.location")
Function uploadedFileList
has 5 return statements (exceeds 4 allowed). Open
Open
func uploadedFileList() (list map[string]string, err error) {
list = make(map[string]string)
files, err := ioutil.ReadDir(filepath.Clean(viper.GetString("uploadFolderTemp")))
if err != nil {
return nil, err
Function SET_CONSULTANTS
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
SET_CONSULTANTS (state, consultants) {
state.all = consultants.sort(function (a, b) {
var nameA = a.name.toUpperCase()
var nameB = b.name.toUpperCase()
if (nameA < nameB) {
- 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"