Skip to content

Commit

Permalink
Remove codebeat tags
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Nov 26, 2024
1 parent e325acc commit 39102ca
Show file tree
Hide file tree
Showing 15 changed files with 0 additions and 87 deletions.
11 changes: 0 additions & 11 deletions cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ var info = []exprInfo{

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// Parse parse cron expression
// https://en.wikipedia.org/wiki/Cron
func Parse(expr string) (*Expr, error) {
Expand Down Expand Up @@ -142,12 +140,8 @@ func Parse(expr string) (*Expr, error) {
return result, nil
}

// codebeat:enable[LOC,ABC]

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC]

// IsDue check if current moment is match for expression
func (e *Expr) IsDue(args ...time.Time) bool {
if e == nil {
Expand Down Expand Up @@ -185,9 +179,6 @@ func (e *Expr) IsDue(args ...time.Time) bool {
return true
}

// I don't have an idea how we can implement this without this conditions
// codebeat:disable[BLOCK_NESTING,LOC,CYCLO]

// Next get time of next matched moment
func (e *Expr) Next(args ...time.Time) time.Time {
if e == nil {
Expand Down Expand Up @@ -308,8 +299,6 @@ func (e *Expr) Prev(args ...time.Time) time.Time {
return time.Unix(0, 0)
}

// codebeat:enable[BLOCK_NESTING,LOC,CYCLO]

// String return raw expression
func (e *Expr) String() string {
if e == nil {
Expand Down
4 changes: 0 additions & 4 deletions fmtc/fmtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ func IsTag(tag string) bool {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,BLOCK_NESTING]

func tag2ANSI(tag string, clean bool) string {
switch {
case clean:
Expand Down Expand Up @@ -449,8 +447,6 @@ func tag2ANSI(tag string, clean bool) string {
return fmt.Sprintf("\033[" + chars[:len(chars)-1] + "m")
}

// codebeat:enable[LOC,BLOCK_NESTING]

func parseExtendedColor(tag string) string {
if len(tag) == 7 {
hex := strings.TrimLeft(tag, "#%")
Expand Down
5 changes: 0 additions & 5 deletions fsutil/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@ func readDirRecFiles(path, base string, ignoreHidden bool, filter ListingFilter)
return result
}

// It's ok to have long function with many conditions to filter some entities
// codebeat:disable[LOC,ABC,CYCLO]

func isMatch(name, fullPath string, filter ListingFilter) bool {
var (
hasNotMatchPatterns = filter.hasNotMatchPatterns()
Expand Down Expand Up @@ -379,8 +376,6 @@ func isMatch(name, fullPath string, filter ListingFilter) bool {
return match
}

// codebeat:enable[LOC,ABC,CYCLO]

func filterList(names []string, dir string, filter ListingFilter) []string {
var filteredNames []string

Expand Down
7 changes: 0 additions & 7 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,6 @@ func (o optionName) String() string {

// ////////////////////////////////////////////////////////////////////////////////// //

// I think it is okay to have such a long and complicated method for parsing data
// because it has a lot of logic which can't be separated into different methods
// without losing code readability
// codebeat:disable[LOC,BLOCK_NESTING,CYCLO]

func (o *Options) parseOptions(rawOpts []string) (Arguments, errors.Errors) {
o.prepare()

Expand Down Expand Up @@ -784,8 +779,6 @@ func (o *Options) parseOptions(rawOpts []string) (Arguments, errors.Errors) {
return arguments, errs
}

// codebeat:enable[LOC,BLOCK_NESTING,CYCLO]

func (o *Options) parseLongOption(opt string) (string, string, error) {
if strings.Contains(opt, "=") {
optName, optValue, ok := strings.Cut(opt, "=")
Expand Down
4 changes: 0 additions & 4 deletions signal/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ func (h Handlers) TrackAsync() {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// GetByName returns signal with given name
func GetByName(name string) (syscall.Signal, error) {
switch strings.ToUpper(name) {
Expand Down Expand Up @@ -245,6 +243,4 @@ func GetByCode(code int) (syscall.Signal, error) {
return syscall.Signal(-1), fmt.Errorf("Unknown signal code %d", code)
}

// codebeat:enable[LOC,ABC]

// ////////////////////////////////////////////////////////////////////////////////// //
5 changes: 0 additions & 5 deletions spellcheck/spellcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ func (m *Model) Suggest(word string, max int) []string {

// ////////////////////////////////////////////////////////////////////////////////// //

// I don't have an idea how we could separate this method
// codebeat:disable[LOC,ABC,CYCLO]

// Damerau–Levenshtein distance algorithm and code
func getDLDistance(source, target string) int {
sl, tl := len(source), len(target)
Expand Down Expand Up @@ -187,8 +184,6 @@ func getDLDistance(source, target string) int {
return h[sl+1][tl+1]
}

// codebeat:enable[LOC,ABC,CYCLO]

func getSuggestSlice(terms []string, word string) suggestItems {
var result suggestItems

Expand Down
9 changes: 0 additions & 9 deletions system/info_cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ func GetCPUUsage(duration time.Duration) (*CPUUsage, error) {
return CalculateCPUUsage(c1, c2), nil
}

// It's ok to have so complex method for calculation
// codebeat:disable[CYCLO]

// CalculateCPUUsage calculates CPU usage based on CPUStats
func CalculateCPUUsage(c1, c2 *CPUStats) *CPUUsage {
prevIdle := c1.Idle + c1.Wait
Expand All @@ -84,8 +81,6 @@ func CalculateCPUUsage(c1, c2 *CPUStats) *CPUUsage {
}
}

// codebeat:enable[CYCLO]

// GetCPUStats returns basic CPU stats
func GetCPUStats() (*CPUStats, error) {
s, closer, err := getFileScanner(procStatFile)
Expand Down Expand Up @@ -148,8 +143,6 @@ func GetCPUCount() (CPUCount, error) {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC,CYCLO]

// parseCPUStats parses cpu stats data
func parseCPUStats(s *bufio.Scanner) (*CPUStats, error) {
var err error
Expand Down Expand Up @@ -288,8 +281,6 @@ func parseCPUInfo(s *bufio.Scanner) ([]*CPUInfo, error) {
return info, nil
}

// codebeat:enable[LOC,ABC,CYCLO]

// parseCPUCountInfo parses CPU count data
func parseCPUCountInfo(data string) uint32 {
startNum := strings.Trim(strutil.ReadField(data, 0, false, '-'), "\n\r")
Expand Down
4 changes: 0 additions & 4 deletions system/info_fs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ func CalculateIOUtil(io1, io2 map[string]*IOStats, duration time.Duration) map[s

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC,CYCLO]

// parseIOStats parses IO stats data
func parseIOStats(s *bufio.Scanner) (map[string]*IOStats, error) {
var err error
Expand Down Expand Up @@ -249,8 +247,6 @@ func parseFSInfo(s *bufio.Scanner, calculateStats bool) (map[string]*FSUsage, er
return info, nil
}

// enable:disable[LOC,ABC,CYCLO]

// getHZ returns number of processor clock ticks per second
func getHZ() float64 {
// CLK_TCK is a constant on Linux
Expand Down
4 changes: 0 additions & 4 deletions system/info_loadavg_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ func GetLA() (*LoadAvg, error) {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// parseLAInfo parses loadavg data
func parseLAInfo(text string) (*LoadAvg, error) {
var err error
Expand Down Expand Up @@ -97,5 +95,3 @@ func parseLAInfo(text string) (*LoadAvg, error) {

return la, nil
}

// codebeat:enable[LOC,ABC]
4 changes: 0 additions & 4 deletions system/info_memory_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func GetMemUsage() (*MemUsage, error) {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// parseMemUsage parses memory usage info
func parseMemUsage(s *bufio.Scanner) (*MemUsage, error) {
var err error
Expand Down Expand Up @@ -91,5 +89,3 @@ func parseMemUsage(s *bufio.Scanner) (*MemUsage, error) {

return mem, nil
}

// codebeat:enable[LOC,ABC]
4 changes: 0 additions & 4 deletions system/info_net_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ func CalculateNetworkSpeed(ii1, ii2 map[string]*InterfaceStats, duration time.Du

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// parseInterfacesStats parses interfaces stats data
func parseInterfacesStats(s *bufio.Scanner) (map[string]*InterfaceStats, error) {
var err error
Expand Down Expand Up @@ -133,8 +131,6 @@ func parseInterfacesStats(s *bufio.Scanner) (map[string]*InterfaceStats, error)
return stats, nil
}

// codebeat:enable[LOC,ABC]

// getActiveInterfacesBytes calculate received and transmitted bytes on all interfaces
func getActiveInterfacesBytes(is map[string]*InterfaceStats) (uint64, uint64) {
var (
Expand Down
8 changes: 0 additions & 8 deletions system/process/process_cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ func GetInfo(pid int) (*ProcInfo, error) {
return parseStatData(text)
}

// codebeat:disable[LOC,ABC]

// GetSample returns ProcSample for CPU usage calculation
func GetSample(pid int) (ProcSample, error) {
fd, err := os.OpenFile(procFS+"/"+strconv.Itoa(pid)+"/stat", os.O_RDONLY, 0)
Expand All @@ -110,8 +108,6 @@ func GetSample(pid int) (ProcSample, error) {
return parseSampleData(text)
}

// codebeat:enable[LOC,ABC]

// CalculateCPUUsage calculates CPU usage
func CalculateCPUUsage(s1, s2 ProcSample, duration time.Duration) float64 {
total := float64(s2 - s1)
Expand All @@ -122,8 +118,6 @@ func CalculateCPUUsage(s1, s2 ProcSample, duration time.Duration) float64 {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// parseStatData parses CPU stats data
func parseStatData(text string) (*ProcInfo, error) {
var err error
Expand Down Expand Up @@ -197,8 +191,6 @@ func parseSampleData(text string) (ProcSample, error) {
return ProcSample(utime + stime + cutime + cstime), nil
}

// codebeat:enable[LOC,ABC]

// parseIntField parses int value of field
func parseIntField(s string, field int) (int, error) {
v, err := strconv.Atoi(s)
Expand Down
4 changes: 0 additions & 4 deletions system/process/process_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ type MemInfo struct {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// GetMemInfo returns info about process memory usage
func GetMemInfo(pid int) (*MemInfo, error) {
fd, err := os.OpenFile(procFS+"/"+strconv.Itoa(pid)+"/status", os.O_RDONLY, 0)
Expand Down Expand Up @@ -102,8 +100,6 @@ func GetMemInfo(pid int) (*MemInfo, error) {
return info, nil
}

// codebeat:enable[LOC,ABC]

// ////////////////////////////////////////////////////////////////////////////////// //

// parseSize parse size in kB
Expand Down
4 changes: 0 additions & 4 deletions system/process/process_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ type MountInfo struct {

// ////////////////////////////////////////////////////////////////////////////////// //

// codebeat:disable[LOC,ABC]

// GetMountInfo returns info about process mounts
func GetMountInfo(pid int) ([]*MountInfo, error) {
fd, err := os.OpenFile(procFS+"/"+strconv.Itoa(pid)+"/mountinfo", os.O_RDONLY, 0)
Expand Down Expand Up @@ -127,8 +125,6 @@ func parseMountInfoLine(data string) (*MountInfo, error) {
return info, nil
}

// codebeat:enable[LOC,ABC]

// parseStDevValue parses st_dev major and minor values
func parseStDevValue(data string) (uint16, uint16, error) {
major, err := parseFieldUint16(strutil.ReadField(data, 0, false, ':'), "StDevMajor")
Expand Down
10 changes: 0 additions & 10 deletions timeutil/timeutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ func FromISOWeek(week, year int, loc *time.Location) time.Time {

// ////////////////////////////////////////////////////////////////////////////////// //

// It's ok to have so long method here
// codebeat:disable[LOC,ABC]

func convertDuration(d any) (time.Duration, bool) {
switch u := d.(type) {
case time.Duration:
Expand Down Expand Up @@ -531,8 +528,6 @@ func replaceDateTag(d time.Time, input, output *bytes.Buffer) {
}
}

// codebeat:enable[LOC,ABC]

func getShortWeekday(d time.Weekday) string {
long := getLongWeekday(d)

Expand Down Expand Up @@ -706,9 +701,6 @@ func getShortDuration(dur time.Duration, highPrecision bool) string {
return fmt.Sprintf("%d:%02d", m, d)
}

// It's ok to have so nested blocks in this method
// codebeat:disable[BLOCK_NESTING]

func getPrettyLongDuration(dur time.Duration) string {
d := int64(dur.Seconds())

Expand Down Expand Up @@ -767,8 +759,6 @@ func getPrettySimpleDuration(dur time.Duration) string {
return "< 1 second"
}

// codebeat:enable[BLOCK_NESTING]

func getPrettyShortDuration(d time.Duration, separator string) string {
switch {
case d >= 24*time.Hour:
Expand Down

0 comments on commit 39102ca

Please sign in to comment.