Examples of JSHint


Examples of com.cj.jshintmojo.jshint.JSHint

          return Boolean.TRUE;
        }
      });

      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;
        }
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

  public void execute() throws MojoExecutionException, MojoFailureException {
      getLog().info("using jshint version " + version);

      final String jshintCode = getEmbeddedJshintCode(version);
     
        final JSHint jshint = new JSHint(jshintCode);

        final Config config = readConfig(this.options, this.globals, this.configFile, this.basedir, log);
        final Cache.Hash cacheHash = new Cache.Hash(config.options, config.globals, this.version, this.configFile, this.directories, this.excludes);
   
    if(directories.isEmpty()){
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

   */

  public void execute() throws MojoExecutionException, MojoFailureException {
      getLog().info("using jshint version " + version);

        JSHint jshint;
        try {
            jshint = new JSHint(version);
        } catch (IllegalArgumentException err) {
            getLog().debug(err);
            throw new MojoFailureException(err.getMessage());
        }
       
       
    if (StringUtils.isNotBlank(this.configFile)) {
      getLog().info("Reading JSHint settings from configuration file: " + this.configFile);
      processConfigFile();
    }
    if(directories.isEmpty()){
      directories.add("src");
    }
   
     getLog().debug("Globals are : " + globals);
   
    try {
      final File targetPath = new File(basedir, "target");
      mkdirs(targetPath);
      final File cachePath = new File(targetPath, "lint.cache");
     
      final Cache cache = readCache(cachePath, new Cache(this.options, this.globals));
     
      if(!nullSafeEquals(options, cache.options)){
        getLog().warn("Options changed ... clearing cache");
        cache.previousResults.clear();
      }
     
      if(!nullSafeEquals(globals, cache.globals)){
        getLog().warn("Globals changed ... clearing cache");
        cache.previousResults.clear();
      }
     
      List<File> javascriptFiles = new ArrayList<File>();

      for(String next: directories){
        File path = new File(basedir, next);
        if(!path.exists() && !path.isDirectory()){
          getLog().warn("You told me to find tests in " + next + ", but there is nothing there (" + path.getAbsolutePath() + ")");
        }else{
          collect(path, javascriptFiles);
        }
      }

      List<File> matches = FunctionalJava.filter(javascriptFiles, new Fn<File, Boolean>(){
        public Boolean apply(File i) {
          for(String exclude : excludes){
            File e = new File(basedir, exclude);
            if(i.getAbsolutePath().startsWith(e.getAbsolutePath())){
              getLog().warn("Excluding " + i);
             
              return Boolean.FALSE;
            }
          }

          return Boolean.TRUE;
        }
      });


      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;
        }
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

  public void execute() throws MojoExecutionException, MojoFailureException {
      getLog().info("using jshint version " + version);

      final String jshintCode = getEmbeddedJshintCode(version);
     
        final JSHint jshint = new JSHint(jshintCode);

        final Config config = readConfig(this.options, this.globals, this.configFile, this.basedir, getLog());
        final Cache.Hash cacheHash = new Cache.Hash(config.options, config.globals, this.version, this.configFile, this.directories, this.excludes);
   
    if(directories.isEmpty()){
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

          return Boolean.TRUE;
        }
      });

      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;
        }
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

  public void execute() throws MojoExecutionException, MojoFailureException {
      getLog().info("using jshint version " + version);

      final String jshintCode = getEmbeddedJshintCode(version);
     
        final JSHint jshint = new JSHint(jshintCode);

        final Config config = readConfig(this.options, this.globals, this.configFile, this.basedir, log);
        final Cache.Hash cacheHash = new Cache.Hash(config.options, config.globals, this.version, this.configFile, this.directories, this.excludes);
   
    if(directories.isEmpty()){
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

          return Boolean.TRUE;
        }
      });

      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;
        }
View Full Code Here

Examples of com.cj.jshintmojo.jshint.JSHint

          return Boolean.TRUE;
        }
      });

      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;
        }
View Full Code Here

Examples of com.eclipsesource.jshint.JSHint

      throw new IllegalArgumentException( "No input files" );
    }
  }

  private void loadJSHint() {
    jshint = new JSHint();
    try {
      if( library != null ) {
        FileInputStream inputStream = new FileInputStream( library );
        try {
          jshint.load( inputStream );
View Full Code Here

Examples of com.eclipsesource.jshint.JSHint

    }
    return descend;
  }

  private JSHint createJSHint( IProject project ) throws CoreException {
    JSHint jshint = new JSHint();
    try {
      InputStream inputStream = getCustomLib();
      if( inputStream != null ) {
        try {
          jshint.load( inputStream );
        } finally {
          inputStream.close();
        }
      } else {
        jshint.load();
      }
      jshint.configure( new ConfigLoader( project ).getConfiguration() );
    } catch( IOException exception ) {
      String message = "Failed to intialize JSHint";
      throw new CoreException( new Status( IStatus.ERROR, Activator.PLUGIN_ID, message, exception ) );
    }
    return jshint;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.