Package com.cj.jshintmojo.cache

Examples of com.cj.jshintmojo.cache.Result


      JSHint jshint = new JSHint();

      final Map<String, Result> currentResults = new HashMap<String, Result>();
      for(File file : matches){
        Result previousResult = cache.previousResults.get(file.getAbsolutePath());
        Result theResult;
        if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
          getLog().info("  " + file );
          List<Error> errors = jshint.run(new FileInputStream(file), options, globals);
          theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
        }else{
          getLog().info("  " + file + " [no change]");
          theResult = previousResult;
        }
       
        if(theResult!=null){
          currentResults.put(theResult.path, theResult);
          Result r = theResult;
          currentResults.put(r.path, r);
          for(Error error: r.errors){
            getLog().error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
          }
        }
View Full Code Here


    }

    private static Map<String, Result> lintTheFiles(final JSHint jshint, final Cache cache, List<File> filesToCheck, final Config config, final Log log) throws FileNotFoundException {
        final Map<String, Result> currentResults = new HashMap<String, Result>();
        for(File file : filesToCheck){
          Result previousResult = cache.previousResults.get(file.getAbsolutePath());
          Result theResult;
          if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
            log.info("  " + file );
            List<Error> errors = jshint.run(new FileInputStream(file), config.options, config.globals);
            theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
          }else{
            log.info("  " + file + " [no change]");
            theResult = previousResult;
          }
         
          if(theResult!=null){
            currentResults.put(theResult.path, theResult);
            Result r = theResult;
            currentResults.put(r.path, r);
            for(Error error: r.errors){
              log.error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
            }
          }
View Full Code Here

      });


      final Map<String, Result> currentResults = new HashMap<String, Result>();
      for(File file : matches){
        Result previousResult = cache.previousResults.get(file.getAbsolutePath());
        Result theResult;
        if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
          getLog().info("  " + file );
          List<Error> errors = jshint.run(new FileInputStream(file), options, globals);
          theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
        }else{
          getLog().info("  " + file + " [no change]");
          theResult = previousResult;
        }
       
        if(theResult!=null){
          currentResults.put(theResult.path, theResult);
          Result r = theResult;
          currentResults.put(r.path, r);
          for(Error error: r.errors){
            getLog().error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
          }
        }
View Full Code Here

    }

    private static Map<String, Result> lintTheFiles(final JSHint jshint, final Cache cache, List<File> filesToCheck, final Config config, final Log log) throws FileNotFoundException {
        final Map<String, Result> currentResults = new HashMap<String, Result>();
        for(File file : filesToCheck){
          Result previousResult = cache.previousResults.get(file.getAbsolutePath());
          Result theResult;
          if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
            log.info("  " + file );
            List<Error> errors = jshint.run(new FileInputStream(file), config.options, config.globals);
            theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
          }else{
            log.info("  " + file + " [no change]");
            theResult = previousResult;
          }
         
          if(theResult!=null){
            currentResults.put(theResult.path, theResult);
            Result r = theResult;
            currentResults.put(r.path, r);
            for(Error error: r.errors){
              log.error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
            }
          }
View Full Code Here

      JSHint jshint = new JSHint();

      final Map<String, Result> currentResults = new HashMap<String, Result>();
      for(File file : matches){
        Result previousResult = cache.previousResults.get(file.getAbsolutePath());
        Result theResult;
        if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
          getLog().info("  " + file );
          List<Error> errors = jshint.run(new FileInputStream(file), options, globals);
          theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
        }else{
          getLog().info("  " + file + " [no change]");
          theResult = previousResult;
        }
       
        if(theResult!=null){
          currentResults.put(theResult.path, theResult);
          Result r = theResult;
          currentResults.put(r.path, r);
          for(Error error: r.errors){
            getLog().error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
          }
        }
View Full Code Here

    }

    private static Map<String, Result> lintTheFiles(final JSHint jshint, final Cache cache, List<File> filesToCheck, final Config config, final Log log) throws FileNotFoundException {
        final Map<String, Result> currentResults = new HashMap<String, Result>();
        for(File file : filesToCheck){
          Result previousResult = cache.previousResults.get(file.getAbsolutePath());
          Result theResult;
          if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
            log.info("  " + file );
            List<Error> errors = jshint.run(new FileInputStream(file), config.options, config.globals);
            theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
          }else{
            log.info("  " + file + " [no change]");
            theResult = previousResult;
          }
         
          if(theResult!=null){
            currentResults.put(theResult.path, theResult);
            Result r = theResult;
            currentResults.put(r.path, r);
            for(Error error: r.errors){
              log.error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
            }
          }
View Full Code Here

        buf.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
        buf.append("<checkstyle version=\"4.3\">\n");
        String[] files = results.keySet().toArray(new String[0]);
        Arrays.sort(files);
        for(String file : files){
            Result result = results.get(file);
            buf.append("\t<file name=\"" + result.path + "\">\n");
            for(JSHint.Error error : result.errors){
                buf.append(String.format("\t\t<error line=\"%d\" column=\"%d\" message=\"%s\" source=\"jshint.%s\" severity=\"%s\" />\n",
                        error.line.intValue(), error.character.intValue(), encode(error.reason), encode(error.code), severity(error.code)));
            }
View Full Code Here

        buf.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
        buf.append("<jslint>\n");
        String[] files = results.keySet().toArray(new String[0]);
        Arrays.sort(files);
        for(String file : files){
            Result result = results.get(file);
            buf.append("\t<file name=\"" + result.path + "\">\n");
            for(JSHint.Error issue : result.errors){
                buf.append(String.format("\t\t<issue line=\"%d\" char=\"%d\" reason=\"%s\" evidence=\"%s\" ",
                        issue.line.intValue(), issue.character.intValue(), encode(issue.reason), encode(issue.evidence)));
                if(StringUtils.isNotEmpty(issue.code)){
View Full Code Here

      JSHint jshint = new JSHint();

      final Map<String, Result> currentResults = new HashMap<String, Result>();
      for(File file : matches){
        Result previousResult = cache.previousResults.get(file.getAbsolutePath());
        Result theResult;
        if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
          getLog().info("  " + file );
          List<Error> errors = jshint.run(new FileInputStream(file), options, globals);
          theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
        }else{
          getLog().info("  " + file + " [no change]");
          theResult = previousResult;
        }
       
        if(theResult!=null){
          currentResults.put(theResult.path, theResult);
          Result r = theResult;
          currentResults.put(r.path, r);
          for(Error error: r.errors){
            getLog().error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
          }
        }
View Full Code Here

      JSHint jshint = new JSHint();

      final Map<String, Result> currentResults = new HashMap<String, Result>();
      for(File file : matches){
        Result previousResult = cache.previousResults.get(file.getAbsolutePath());
        Result theResult;
        if(previousResult==null || (previousResult.lastModified.longValue()!=file.lastModified())){
          getLog().info("  " + file );
          List<Error> errors = jshint.run(new FileInputStream(file), options, globals);
          theResult = new Result(file.getAbsolutePath(), file.lastModified(), errors);
        }else{
          getLog().info("  " + file + " [no change]");
          theResult = previousResult;
        }
       
        if(theResult!=null){
          currentResults.put(theResult.path, theResult);
          Result r = theResult;
          currentResults.put(r.path, r);
          for(Error error: r.errors){
            getLog().error("   " + error.line.intValue() + "," + error.character.intValue() + ": " + error.reason);
          }
        }
View Full Code Here

TOP

Related Classes of com.cj.jshintmojo.cache.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.