AugurProject/augur-core

View on GitHub

Showing 833 of 833 total issues

Function upload has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    private async upload(contract: Contract): Promise<void> {
        const contractsToDelegate: {[key:string]: boolean} = {"Orders": true, "TradingEscapeHatch": true, "Cash": true};
        const contractName = contract.contractName
        if (contractName === 'Controller') return;
        if (contractName === 'Delegator') return;
Severity: Minor
Found in source/libraries/ContractDeployer.ts - About 2 hrs to fix

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 proceedToNextRound has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public async proceedToNextRound(fixture: TestFixture, market: Market, doGenerateFees: boolean = false, moveTimeForward: boolean = true, randomPayoutNumerators: boolean = false) {
        const currentTimestamp = await fixture.getTimestamp();
        const marketEndTime = await market.getEndTime_();
        if (currentTimestamp.lt(marketEndTime)) {
            const marketDesignatedReportingEndTime = await market.getDesignatedReportingEndTime_();
Severity: Major
Found in source/tests-integration/ReportingUtils.ts - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public async getOrderAmount(orderID: string): Promise<BN> {
            const ordersContract = await this.contractDeployer.getContract("Orders");
            const orders = new Orders(this.connector, this.accountManager, ordersContract.address, TestFixture.GAS_PRICE);
            return await orders.getAmount_(orderID);
        }
    Severity: Major
    Found in source/tests-integration/TestFixture.ts and 1 other location - About 2 hrs to fix
    source/tests-integration/TestFixture.ts on lines 246..250

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 89.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public async getLegacyRepBalance(owner: string): Promise<BN> {
            const legacyRepContract = await this.contractDeployer.getContract("LegacyReputationToken");
            const legacyRep = new LegacyReputationToken(this.connector, this.accountManager, legacyRepContract.address, TestFixture.GAS_PRICE);
            return await legacyRep.balanceOf_(owner);
        }
    Severity: Major
    Found in source/tests-integration/TestFixture.ts and 1 other location - About 2 hrs to fix
    source/tests-integration/TestFixture.ts on lines 140..144

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 89.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Controller has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

        export class Controller extends Contract {
            public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                super(connector, accountManager, address, defaultGasPrice);
            }
    
    
    Severity: Minor
    Found in source/libraries/ContractInterfaces.ts - About 2 hrs to fix

      Map has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

          export class Map extends Controlled {
              public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                  super(connector, accountManager, address, defaultGasPrice);
              }
      
      
      Severity: Minor
      Found in source/libraries/ContractInterfaces.ts - About 2 hrs to fix

        Function contractInterfacesTemplate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private contractInterfacesTemplate(contracts: CompilerOutputContracts) {
                const contractInterfaces: Array<string> = [];
        
                // We add Controlled first to let other contracts inherit from it
                contractInterfaces.push(this.contractInterfaceTemplate("Controlled", contracts["Controlled.sol"]["Controlled"].abi));
        Severity: Major
        Found in source/libraries/ContractInterfacesGenerator.ts - About 2 hrs to fix

          Function generate_inputs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def generate_inputs():
              inputs = []
              for directory, _, filenames in walk(resolveRelativePath('../contracts')):
                  if 'libraries' in directory: continue
                  if 'legacy_reputation' in directory: continue
          Severity: Minor
          Found in source/tools/runOyente.py - About 2 hrs to fix

          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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public async sellCompleteSets(market: Market, amount: BN): Promise<void> {
                  const completeSetsContract = await this.contractDeployer.getContract("CompleteSets");
                  const completeSets = new CompleteSets(this.connector, this.accountManager, completeSetsContract.address, TestFixture.GAS_PRICE);
          
                  await completeSets.publicSellCompleteSets(market.address, amount);
          Severity: Major
          Found in source/tests-integration/TestFixture.ts and 1 other location - About 1 hr to fix
          source/tests-integration/TestFixture.ts on lines 122..127

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public async claimTradingProceeds(market: Market, shareholder: string): Promise<void> {
                  const claimTradingProceedsContract = await this.contractDeployer.getContract("ClaimTradingProceeds");
                  const claimTradingProceeds = new ClaimTradingProceeds(this.connector, this.accountManager, claimTradingProceedsContract.address, TestFixture.GAS_PRICE);
                  await claimTradingProceeds.claimTradingProceeds(market.address, shareholder);
                  return;
          Severity: Major
          Found in source/tests-integration/TestFixture.ts and 1 other location - About 1 hr to fix
          source/tests-integration/TestFixture.ts on lines 168..174

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public async cancelOrder(orderID: string): Promise<void> {
                  const cancelOrderContract = await this.contractDeployer.getContract("CancelOrder");
                  const cancelOrder = new CancelOrder(this.connector, this.accountManager, cancelOrderContract.address, TestFixture.GAS_PRICE);
          
                  await cancelOrder.cancelOrder(orderID);
          Severity: Major
          Found in source/tests-integration/TestFixture.ts and 1 other location - About 1 hr to fix
          source/tests-integration/TestFixture.ts on lines 219..224

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public async setTimestamp(timestamp: BN): Promise<void> {
                  const timeContract = await this.contractDeployer.getContract("TimeControlled");
                  const time = new TimeControlled(this.connector, this.accountManager, timeContract.address, TestFixture.GAS_PRICE);
                  await time.setTimestamp(timestamp);
                  return;
          Severity: Major
          Found in source/tests-integration/TestFixture.ts and 1 other location - About 1 hr to fix
          source/tests-integration/TestFixture.ts on lines 114..120

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function compileContracts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public async compileContracts(): Promise<CompilerOutput> {
                  // Check if all contracts are cached (and thus do not need to be compiled)
                  try {
                      const stats = await fs.stat(this.configuration.contractOutputPath);
                      const lastCompiledTimestamp = stats.mtime;
          Severity: Minor
          Found in source/libraries/ContractCompiler.ts - About 1 hr to fix

          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 getTsTypeFromPrimitive has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private getTsTypeFromPrimitive(abiType: Primitive) {
                  switch(abiType) {
                      case 'uint8':
                      case 'uint64':
                      case 'uint256':
          Severity: Minor
          Found in source/libraries/ContractInterfacesGenerator.ts - About 1 hr to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            doWork().then(() => {
                process.exit();
            }).catch(error => {
                console.log(error);
                process.exit(1);
            Severity: Major
            Found in source/tools/generateContractInterfaces.ts and 1 other location - About 1 hr to fix
            source/tools/migrateRep.ts on lines 51..56

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 65.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            doWork().then(() => {
                process.exit();
            }).catch(error => {
                console.log(error);
                process.exit(1);
            Severity: Major
            Found in source/tools/migrateRep.ts and 1 other location - About 1 hr to fix
            source/tools/generateContractInterfaces.ts on lines 15..20

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 65.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public async getUniverse(market: Market): Promise<Universe> {
                    const universeAddress = await market.getUniverse_();
                    return new Universe(this.connector, this.accountManager, universeAddress, TestFixture.GAS_PRICE);
                }
            Severity: Major
            Found in source/tests-integration/TestFixture.ts and 2 other locations - About 1 hr to fix
            source/tests-integration/TestFixture.ts on lines 200..203
            source/tests-integration/TestFixture.ts on lines 214..217

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 65.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public async getFeeWindow(market: Market): Promise<FeeWindow> {
                    const feeWindowAddress = await market.getFeeWindow_();
                    return new FeeWindow(this.connector, this.accountManager, feeWindowAddress, TestFixture.GAS_PRICE);
                }
            Severity: Major
            Found in source/tests-integration/TestFixture.ts and 2 other locations - About 1 hr to fix
            source/tests-integration/TestFixture.ts on lines 209..212
            source/tests-integration/TestFixture.ts on lines 214..217

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 65.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public async getWinningReportingParticipant(market: Market): Promise<DisputeCrowdsourcer> {
                    const reportingParticipantAddress = await market.getWinningReportingParticipant_();
                    return new DisputeCrowdsourcer(this.connector, this.accountManager, reportingParticipantAddress, TestFixture.GAS_PRICE);
                }
            Severity: Major
            Found in source/tests-integration/TestFixture.ts and 2 other locations - About 1 hr to fix
            source/tests-integration/TestFixture.ts on lines 200..203
            source/tests-integration/TestFixture.ts on lines 209..212

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 65.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            doWork().then(() => {
                process.exit();
            }).catch(error => {
                console.log(error);
                process.exit();
            Severity: Major
            Found in source/deployment/compileContracts.ts and 1 other location - About 1 hr to fix
            source/deployment/compileAndDeploy.ts on lines 24..29

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language