18F/federalist

View on GitHub

Showing 83 of 394 total issues

File site.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const { Op } = require('sequelize');
const { toInt } = require('../utils');
const {
  branchRegex, isEmptyOrUrl, isValidSubdomain,
} = require('../utils/validators');
Severity: Minor
Found in api/models/site.js - About 2 hrs to fix

    Function sites has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function sites(state = initialState, action) {
      switch (action.type) {
        case HTTP_ERROR:
          return { ...state, isLoading: false };
    
    
    Severity: Minor
    Found in frontend/reducers/sites.js - About 1 hr to fix

      Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (sequelize, DataTypes) => {
        const UAAIdentity = sequelize.define('UAAIdentity', {
          uaaId: {
            type: DataTypes.STRING,
            allowNull: false,
      Severity: Minor
      Found in api/models/uaa-identity.js - About 1 hr to fix

        Function setValue has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function setValue(newValue) {
            let oldValue = value;
            let str; let
              len;
        
        
        Severity: Minor
        Found in admin-client/src/lib/jsonTreeView.js - About 1 hr to fix

          Function up has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.up = async (db) => {
            await db.createTable(TABLE_NAME, TABLE_SCHEMA);
            await db.addIndex(TABLE_NAME, TABLE_INDEX_NAME, ["siteId", "branch"], true);
            const { rows: sites } = await db.runSql(SELECT_SITE_CONFIGS);
          
          
          Severity: Minor
          Found in migrations/20230609155951-create-site-branch-config.js - About 1 hr to fix

            Function expand has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function expand(recursive, silent) {
                let keys;
            
                if (type == 'object') {
                  keys = Object.keys(value);
            Severity: Minor
            Found in admin-client/src/lib/jsonTreeView.js - About 1 hr to fix

              Function createBuildForWebhookRequest has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const createBuildForWebhookRequest = async (payload, site) => {
                const { login } = payload.sender;
                const { pushed_at: pushedAt } = payload.repository;
                const username = login.toLowerCase();
              
              
              Severity: Minor
              Found in api/services/Webhooks.js - About 1 hr to fix

                Function SitePublishedFilesTable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function SitePublishedFilesTable() {
                  const { id, name } = useParams();
                  const publishedFiles = useSelector(state => state.publishedFiles);
                
                  const [currentPage, setCurrentPage] = useState(0);
                Severity: Minor
                Found in frontend/components/site/SitePublishedFilesTable.jsx - About 1 hr to fix

                  Function provision has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function provision(domain, dnsResults) {
                    if (!domain.isPending()) {
                      throw new Error(`Only '${States.Pending}' domains can be provisioned.`);
                    }
                  
                  
                  Severity: Minor
                  Found in api/services/Domain.js - About 1 hr to fix

                    Function verifyUAAUser has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function verifyUAAUser(accessToken, refreshToken, profile, uaaGroups) {
                      const { user_id: uaaId, email } = profile;
                    
                      const client = new UAAClient();
                      const isVerified = await client.verifyUserGroup(uaaId, uaaGroups);
                    Severity: Minor
                    Found in api/services/uaaStrategy.js - About 1 hr to fix

                      Function auditSite has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const auditSite = (auditor, site, userIndex = 0) => {
                        let collaborators;
                        const user = site.Users[userIndex];
                        if (!user) { return Promise.resolve(); }
                      
                      
                      Severity: Minor
                      Found in api/services/SiteUserAuditor.js - About 1 hr to fix

                        Function editFieldStop has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function editFieldStop(field) {
                            const element = dom[field];
                        
                            if (field == 'name') {
                              if (!edittingName) {
                        Severity: Minor
                        Found in admin-client/src/lib/jsonTreeView.js - About 1 hr to fix

                          Function createExternalDomain has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async createExternalDomain(params) {
                              const {
                                domains,
                                name,
                                origin,
                          Severity: Minor
                          Found in api/utils/cfApiClient.js - About 1 hr to fix

                            Function destroy has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              async destroy(req, res) {
                                const { params, user } = req;
                                const { id, site_id: siteId } = params;
                            
                                const site = await Site.forUser(user)
                            Severity: Minor
                            Found in api/controllers/site-branch-config.js - About 1 hr to fix

                              Function createExternalDomain has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async createExternalDomain(params) {
                                  const {
                                    domains,
                                    name,
                                    origin,
                              Severity: Minor
                              Found in apps/metrics/lib/cfApiClient.js - About 1 hr to fix

                                Function migrated has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const migrated = sites.map(async (site) => {
                                    const {
                                      id: siteId,
                                      owner,
                                      repository,
                                Severity: Minor
                                Found in migrations/20230609155951-create-site-branch-config.js - About 1 hr to fix

                                  Function archiveBuildLogsDaily has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  async function archiveBuildLogsDaily(job) {
                                    const logger = createJobLogger(job);
                                    // our daily job uses a three day window to check for previous logs in case of failure
                                    const startDate = moment().subtract(3, 'days').startOf('day');
                                    const endDate = startDate.clone().add(3, 'days');
                                  Severity: Minor
                                  Found in api/workers/jobProcessors/archiveBuildLogsDaily.js - About 1 hr to fix

                                    Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      constructor(baseURL) {
                                        /**
                                         * @type {axios.AxiosInstance}
                                         */
                                        this.client = axios.create({
                                    Severity: Minor
                                    Found in apps/metrics/lib/httpClient.js - About 1 hr to fix

                                      Function rebuild has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        async rebuild(req, res) {
                                          const requestBuild = await Build.findOne({
                                            where: {
                                              id: req.body.buildId,
                                              site: req.body.siteId,
                                      Severity: Minor
                                      Found in api/admin/controllers/build.js - About 1 hr to fix

                                        Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          constructor(baseURL) {
                                            /**
                                             * @type {axios.AxiosInstance}
                                             */
                                            this.client = axios.create({
                                        Severity: Minor
                                        Found in api/bull-board/httpClient.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language