Skip to content

Improve lint configuration#606

Draft
jbsv wants to merge 6 commits intomasterfrom
improve-lint-configuration
Draft

Improve lint configuration#606
jbsv wants to merge 6 commits intomasterfrom
improve-lint-configuration

Conversation

@jbsv
Copy link
Contributor

@jbsv jbsv commented Jan 22, 2026

No description provided.

@jbsv jbsv requested a review from thehoul January 22, 2026 07:07
@jbsv jbsv added the safe PR label Jan 22, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
14.3% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

@jbsv jbsv marked this pull request as draft January 22, 2026 07:16
@jbsv jbsv removed the request for review from thehoul January 22, 2026 07:16
Copy link
Contributor

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup, just a few comments.

func (d *DistKeyGenerator) Deals() (*DealBundle, error) {
if !d.canIssue {
return nil, fmt.Errorf("new members can't issue deals")
return nil, errors.New("new members can't issue deals")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should be an exported NamedError so people can match against it.

if !d.canReceive && d.state != DealPhase {
// if we are a old node that will leave
return nil, nil, fmt.Errorf("leaving node can process responses only after creating shares")
return nil, nil, errors.New("leaving node can process responses only after creating shares")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should be an exported NamedError so people can match against it.

return nil, nil, fmt.Errorf("leaving node can process responses only after creating shares")
return nil, nil, errors.New("leaving node can process responses only after creating shares")
} else if d.state != ResponsePhase {
return nil, nil, fmt.Errorf("can only process responses after processing shares - current state %s", d.state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first part here could be a NamedError, and the fmt.Errorf could wrap it using %w - current state: %s

Comment on lines +10 to 14
"go.dedis.ch/kyber/v4/sign/bls"

"github.com/stretchr/testify/require"
"go.dedis.ch/kyber/v4"
"go.dedis.ch/kyber/v4/pairing/bls12381/kilic"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these don't look optimally grouped, maybe the linter needs some extra settings to add a local group before the external deps?

Comment on lines 160 to 163
scalarCanonical, ok := group.Scalar().(scalarCanCheckCanonical)
if !ok {
return fmt.Errorf("could not cast group scalar to canonical")
return errors.New("could not cast group scalar to canonical")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this look like something that should be implemented as a compile time check rather than a type cast here by declaring a global variable like:

var _ scalarCanCheckCanonical = group.Scalar()

just after the declaration of group

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's funny we're using exported errors for eddsa but not for schnorr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants