zalando/zappr

View on GitHub

Showing 190 of 190 total issues

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

            this.kms.decrypt({CiphertextBlob: blob}, (err, data) => {
                if (err) {
                    error(err)
                    return reject(err)
                }
Severity: Major
Found in server/service/encryption/KMSEncryptionService.js and 1 other location - About 1 hr to fix
server/service/encryption/KMSEncryptionService.js on lines 21..28

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 59.

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

export default async function renderStatic(ctx, next) {

  const assets = await getStaticAssets()
  const user = ctx.req.user ? ctx.req.user.json : {}
  // at this point the cookie is guaranteed to exist due to previous middleware
Severity: Minor
Found in server/react/render-static.jsx - About 1 hr to fix

    Function updateWebhookFor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async updateWebhookFor(user, repo, events, accessToken) {
        debug(`${user}/${repo}: updating webhook with events: ${events.join(", ")}`)
        let path = API_URL_TEMPLATES.HOOK.replace('${owner}', user).replace('${repo}', repo)
        const HOOK_URL = nconf.get('HOOK_URL')
        let hook_url = HOOK_URL ? HOOK_URL : nconf.get('HOST_ADDR') + '/api/hook'
    Severity: Minor
    Found in server/service/GithubService.js - About 1 hr to fix

      Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const {selected, isUpdating, filterBy} = this.props
          const repos = this.sortedRepositories()
      
          const header = <header>
      Severity: Minor
      Found in client/components/RepositoryList.jsx - About 1 hr to fix

        Function createShipper has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createShipper() {
          switch (shipEngine) {
            case 'file':
              const FILENAME = nconf.get('AUDIT_FILENAME') || "audit.log"
              const MAXSIZE = nconf.get('AUDIT_MAX_SIZE') || 10 ** 7 // 10 MB default max size
        Severity: Minor
        Found in server/service/AuditServiceCreator.js - About 1 hr to fix

          Function onGetOne has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async onGetOne(id, user = null, includeToken = false, autoSync = false) {
              debug(`get Repository ${id}, autoSync ${autoSync}`)
              let repository
              try {
                if (user) {
          Severity: Minor
          Found in server/handler/RepositoryHandler.js - About 1 hr to fix

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

                        <Col sm={4}>
                          <h4>Code Review</h4>
                          <p>Zappr is our attempt to <Highlight>restore and improve code review</Highlight> to the process of
                            developing a project on
                            GitHub. GitHub doesn't impose restrictions on project contributions. While great for openness, this
            Severity: Major
            Found in client/containers/Login.jsx and 1 other location - About 1 hr to fix
            client/containers/Login.jsx on lines 128..136

            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 58.

            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

              onDeletePullRequest(repositoryId, number) {
                debug(`delete pr ${number} for repo ${repositoryId}`)
                return PullRequest.destroy({ where: { repositoryId, number }})
              }
            Severity: Major
            Found in server/handler/PullRequestHandler.js and 1 other location - About 1 hr to fix
            server/handler/PullRequestHandler.js on lines 20..25

            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 58.

            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

              onGet(repositoryId, number) {
                debug(`reading pr ${number} of repo ${repositoryId}`)
                return PullRequest.findOne({
                  where: {repositoryId, number}
                })
            Severity: Major
            Found in server/handler/PullRequestHandler.js and 1 other location - About 1 hr to fix
            server/handler/PullRequestHandler.js on lines 15..18

            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 58.

            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

                        <Col sm={4}>
                          <h4>Compliance</h4>
                          <p>We are proponents of being able to do as much work as possible in GitHub, using GitHub. When working
                            with compliance requirements, however, this can get tricky: <Highlight>how can developers employ the
                              four-eyes
            Severity: Major
            Found in client/containers/Login.jsx and 1 other location - About 1 hr to fix
            client/containers/Login.jsx on lines 121..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 58.

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

              render() {
                const style = {
                  marginLeft: 15
                }
                const {check, onToggle} = this.props
            Severity: Minor
            Found in client/components/RepositoryCheck.jsx - About 1 hr to fix

              Function checkComment has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  async function checkComment(stats, comment) {
                    let matchesTotal = false
                    if (config.from) {
                      matchesTotal = await that.doesCommentMatchConfig(repository, comment, config.from, token)
                      if (matchesTotal) {
              Severity: Minor
              Found in server/checks/Approval.js - About 1 hr to fix

                Function init has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function init(options = {}) {
                  const passport = initPassport(options.PassportStrategy)
                
                  return app.use(generatePrometheusMiddleware(router, {
                              ignore: [/^\/repository/]
                Severity: Minor
                Found in server/server.js - About 1 hr to fix

                  Function decryptTokenHook has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function decryptTokenHook(thing) {
                    /**
                     * We check for the existence of a function `set` because if there is none,
                     * it means that we selected with raw=true and thus don't want to change
                     * the raw database content.
                  Severity: Minor
                  Found in server/model/Database.js - About 1 hr to fix

                    Function getPrMergedEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function getPrMergedEvent(auditEvent) {
                      const event_type = {
                        namespace: 'cloud.zalando.com',
                        name: 'pull-request-merged',
                        version: nconf.get('AUDIT_EVENT_VERSION') || 1
                    Severity: Minor
                    Found in server/service/audit/transform/ZalandoAuditTrail.js - About 1 hr to fix

                      Function generateStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        static generateStatus({approvals, vetos}, {minimum, groups}) {
                          if (vetos.length > 0) {
                            return {
                              description: `Vetoes: ${vetos.map(u => `@${u}`).join(', ')}.`,
                              state: 'failure',
                      Severity: Minor
                      Found in server/checks/Approval.js - About 55 mins 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

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

                          return await Repository.userScope(user).findAllSorted({
                            include: [{
                              model: Check,
                              attributes: {exclude: includeToken ? [] : ['token']}
                            }]
                      Severity: Minor
                      Found in server/handler/RepositoryHandler.js and 1 other location - About 55 mins to fix
                      server/handler/RepositoryHandler.js on lines 151..156

                      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 53.

                      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

                      export class GithubBranchProtectedError extends Error {
                        /**
                         * @param {Object} response - HTTP response
                         */
                        constructor(response) {
                      Severity: Minor
                      Found in server/service/GithubServiceError.js and 1 other location - About 55 mins to fix
                      server/service/GithubServiceError.js on lines 20..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 53.

                      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

                      export default class GithubServiceError extends Error {
                        /**
                         * @param {Object} response - HTTP response
                         */
                        constructor(response) {
                      Severity: Minor
                      Found in server/service/GithubServiceError.js and 1 other location - About 55 mins to fix
                      server/service/GithubServiceError.js on lines 31..40

                      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 53.

                      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

                          let repos = await Repository.userScope(user).findAllSorted({
                            include: [{
                              model: Check,
                              attributes: {exclude: includeToken ? [] : ['token']}
                            }]
                      Severity: Minor
                      Found in server/handler/RepositoryHandler.js and 1 other location - About 55 mins to fix
                      server/handler/RepositoryHandler.js on lines 168..173

                      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 53.

                      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