jeresig/pharos-images

View on GitHub

Showing 106 of 451 total issues

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

    renderHeader() {
        const gettext = this.props.gettext;
        const URL = this.props.URL;

        return <div className="navbar navbar-default navbar-static-top">
Severity: Minor
Found in views/Page.jsx - About 1 hr to fix

    Function processImages has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        processImages(callback) {
            const zipFile = fs.createReadStream(this.zipFile);
            let zipError;
            const files = [];
            const extractDir = path.join(os.tmpdir(),
    Severity: Minor
    Found in schemas/ImageImport.js - About 1 hr to fix

      Function importArtworks has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          importArtworks(callback) {
              const Artwork = models("Artwork");
              const Source = models("Source");
      
              async.eachLimit(this.results, 1, (result, callback) => {
      Severity: Minor
      Found in schemas/ArtworkImport.js - About 1 hr to fix

        Function renderArtwork has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderArtwork() {
                const compare = this.props.compare;
                const artworks = this.props.artworks;
                const artworkWidth = this.props.similar.length > 0 ?
                    "col-md-9" : "col-md-12";
        Severity: Minor
        Found in views/Artwork.jsx - About 1 hr to fix

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

              render() {
                  const format = this.props.format;
                  const gettext = this.props.gettext;
          
                  const title = format(gettext("Image Import: %(fileName)s"),
          Severity: Minor
          Found in views/ImportImages.jsx - About 1 hr to fix

            Function fromFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fromFile(file, callback) {
                    const UploadImage = models("UploadImage");
            
                    const sourceDir = getDirBase();
            
            
            Severity: Minor
            Found in schemas/UploadImage.js - About 1 hr to fix

              Function schema has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  schema(Schema) {
                      const YearRangeSchema = new Schema({
                          // An ID for the year range, computed from the original + start/end
                          // properties before validation.
                          _id: String,
              Severity: Minor
              Found in schemas/types/YearRange.js - About 1 hr to fix

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

                    render() {
                        const searchName = this.props.searchName || this.props.name;
                
                        return <div className="row">
                            <div className="form-group col-xs-6 col-sm-12 col-lg-6">
                Severity: Minor
                Found in views/types/filter/Dimension.jsx - About 1 hr to fix

                  Function searchByProps has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const searchByProps = function(root, propMap) {
                      const results = {};
                  
                      const getByTagName = (name) => {
                          const node = root.get(`.//${name}`);
                  Severity: Minor
                  Found in converters/marburg.js - About 1 hr to fix

                    Function renderUploadImagesForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        renderUploadImagesForm() {
                            return <div className="panel panel-default">
                                <div className="panel-heading">
                                    <h3 className="panel-title">
                                        {this.props.gettext("Upload Images")}
                    Severity: Minor
                    Found in views/Admin.jsx - About 1 hr to fix

                      Function searchByProps has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const searchByProps = function(root, propMap) {
                          const results = {};
                      
                          const getByTagName = (name) => {
                              const node = root.get(`.//${name}`);
                      Severity: Minor
                      Found in converters/fzeri.js - About 1 hr to fix

                        Function renderSearchForm has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            renderSearchForm() {
                                const similarity = this.props.queries.similar.filters;
                        
                                return <form action={this.props.URL("/search")} method="GET">
                                    <input type="hidden" name="lang" value={this.props.lang}/>
                        Severity: Minor
                        Found in views/Search.jsx - About 1 hr to fix

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

                                  uploadData(req, res, next) {
                                      const source = req.source;
                          
                                      const form = new formidable.IncomingForm();
                                      form.encoding = "utf-8";
                          Severity: Minor
                          Found in logic/admin.js - About 1 hr to fix

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

                                schema(Schema) {
                                    const NameSchema = new Schema({
                                        // An ID for the name, computed from the original + name properties
                                        // before validation.
                                        _id: String,
                            Severity: Minor
                            Found in schemas/types/Name.js - About 1 hr to fix

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

                                      show(req, res) {
                                          const compare = ("compare" in req.query);
                                          const id = `${req.params.source}/${req.params.artworkName}`;
                              
                                          Artwork.findById(id, (err, artwork) => {
                              Severity: Minor
                              Found in logic/artworks.js - About 1 hr to fix

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

                                    breadcrumb(value, i18n) {
                                        const breadcrumbs = [];
                                
                                        if (value.heightMin || value.heightMax) {
                                            const title = this.options.heightTitle(i18n);
                                Severity: Minor
                                Found in schemas/types/Dimension.js - About 1 hr to fix

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

                                      render() {
                                          const id = this.props.id;
                                          const allResults = this.props.batch.getFilteredResults()[id];
                                          const showAll = this.props.format(this.props.gettext(
                                              "Show all %(count)s results..."),
                                  Severity: Minor
                                  Found in views/ImportResult.jsx - About 1 hr to fix

                                    Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    module.exports = (req, res, tmplParams) => {
                                        // Collect all the values from the request to construct
                                        // the search URL and matches later
                                        // Generate the filters and facets which will be fed in to Elasticsearch
                                        // to build the query filter and aggregations
                                    Severity: Minor
                                    Found in logic/shared/search.js - 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 paramFilter has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const paramFilter = (values, keepSecondary) => {
                                        const all = {};
                                        const primary = [];
                                        const secondary = {};
                                    
                                    
                                    Severity: Minor
                                    Found in logic/shared/param-filter.js - About 1 hr to fix

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

                                          const importImages = (req, res) => {
                                              const Image = models("Image");
                                      
                                              const batchState = (batch) => batch.getCurState().name(req);
                                              const batchError = (err) => ImageImport.getError(req, err);
                                      Severity: Minor
                                      Found in logic/admin.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language