Showing 10 of 20 total issues
Function exports
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function withClientTrace
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func withClientTrace(ctx context.Context, r *Result) context.Context {
trace := &httptrace.ClientTrace{
DNSStart: func(i httptrace.DNSStartInfo) {
r.dnsStart = time.Now()
},
Method GenericEvent.UnmarshalJSON
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *GenericEvent) UnmarshalJSON(data []byte) error {
var temp EventWrapper
if err := json.Unmarshal(data, &temp); err != nil {
return fmt.Errorf("Unmarshal event error: %w", err)
Function Check
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Check(req *http.Request) *CheckResponse {
req.Header.Set("User-Agent", "noty/2.0 (https://noty.im)")
var result Result
ctx := WithHTTPStat(req.Context(), &result)
Method GenericEvent.UnmarshalJSON
has 10 return statements (exceeds 4 allowed). Open
func (e *GenericEvent) UnmarshalJSON(data []byte) error {
var temp EventWrapper
if err := json.Unmarshal(data, &temp); err != nil {
return fmt.Errorf("Unmarshal event error: %w", err)
Method verify
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def verify
if VerificationService.check_to_verify(@verification, params[:code])
case @verification.verifiable
when Receiver
redirect_to receivers_url, flash: { notice: 'You have succesflly confirm the contact' }
- 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
Method Server.SetupRoute
has 6 return statements (exceeds 4 allowed). Open
func (s *Server) SetupRoute() {
secureMiddleware := secure.New(secure.Options{
AllowedHosts: []string{"noty.ax", "gaia.noty.im", "laputa.noty.im", ".*.noty.im"},
AllowedHostsAreRegex: true,
HostsProxyHeaders: []string{"X-Forwarded-Host"},
Method auto_prefix
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def auto_prefix
case @check.type
when Check::TYPE_HTTP
@check.uri = "http://#{@check.uri}" unless @check.uri.start_with?('http')
when Check::TYPE_TCP
- 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
Method save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.save(receiver)
raise 'UserCannotManageTeam' unless can_view?(receiver)
VerificationService.generate(receiver) if receiver.save! && receiver.require_verify?
- 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
Method Agent.SyncState
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (a *Agent) SyncState() {
defer a.conn.Close()
done := make(chan struct{})
go func() {
- 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"