From 5fb0cf576bbee2a35f261125cade76f8d5a90fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 14 Nov 2018 20:47:18 +0100 Subject: [PATCH] Releasable --- .travis/render_release_notes.rb | 11 ++-- docs/_config.yml | 2 +- docs/_plugins/all_extensions.rb | 3 ++ docs/_plugins/javadoc_tag.rb | 53 ++++++++++--------- docs/pages/release_notes.md | 6 +-- .../pmd/properties/LongMultiProperty.java | 2 - 6 files changed, 42 insertions(+), 35 deletions(-) create mode 100644 docs/_plugins/all_extensions.rb diff --git a/.travis/render_release_notes.rb b/.travis/render_release_notes.rb index dc0eb0877d..c7d0542cd7 100755 --- a/.travis/render_release_notes.rb +++ b/.travis/render_release_notes.rb @@ -12,9 +12,7 @@ require "liquid" require "safe_yaml" # include some custom liquid extensions -require_relative "../docs/_plugins/rule_tag" -require_relative "../docs/_plugins/tocmaker_block" -require_relative "../docs/_plugins/custom_filters" +require_relative "../docs/_plugins/all_extensions" # explicitly setting safe mode to get rid of the warning SafeYAML::OPTIONS[:default_mode] = :safe @@ -22,15 +20,18 @@ SafeYAML::OPTIONS[:default_mode] = :safe # START OF THE SCRIPT unless ARGV.length == 1 && File.exists?(ARGV[0]) - print "\e[31m[ERROR] In #{$0}: The first arg must be a valid file name\e[0m" + print "\e[31m[ERROR] In #{$0}: The first arg must be a valid file name\e[0m\n" exit 1 end release_notes_file = ARGV[0] +# Make the script execute wherever we are +travis_dir = File.expand_path File.dirname(__FILE__) + liquid_env = { # wrap the config under a "site." namespace because that's how jekyll does it - 'site' => YAML.load_file("docs/_config.yml"), + 'site' => YAML.load_file(travis_dir + "/../docs/_config.yml"), # This signals the links in {% rule %} tags that they should be rendered as absolute 'is_release_notes_processor' => true } diff --git a/docs/_config.yml b/docs/_config.yml index f1d6e64a9c..8fcdabf962 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,7 +1,7 @@ repository: pmd/pmd pmd: - version: 6.9.0 + version: 6.10.0 previous_version: 6.9.0 date: ??-????-2018 release_type: minor diff --git a/docs/_plugins/all_extensions.rb b/docs/_plugins/all_extensions.rb new file mode 100644 index 0000000000..fe23de11c4 --- /dev/null +++ b/docs/_plugins/all_extensions.rb @@ -0,0 +1,3 @@ +# This file requires all the defined Liquid extensions for ease of reference +# Thanks stackoverflow <3 +Dir[File.join(File.dirname(__FILE__), "*.rb")].reject {|file| file == __FILE__}.each {|file| require file} diff --git a/docs/_plugins/javadoc_tag.rb b/docs/_plugins/javadoc_tag.rb index 8be83cca4f..f6bb45d075 100644 --- a/docs/_plugins/javadoc_tag.rb +++ b/docs/_plugins/javadoc_tag.rb @@ -28,6 +28,16 @@ require_relative 'jdoc_namespace_tag' # 'properties.PropertyDescriptor' is expanded to 'net.sourceforge.pmd.properties.PropertyDescriptor' # This is rendered as [`PropertyDescriptor`](https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html) # +# +# * To reference a package: eg {% jdoc_package core::properties %} -> points to pmd-core, expanded to 'net.sourceforge.pmd.properties' +# +# * To reference a method or field: {% jdoc core::Rule#addRuleChainVisit(java.lang.Class) %} +# * The suffix # is followed by the name of the method or field +# * The (erased) types of method arguments must be fully qualified. This is the same +# convention as in javadoc {@link} tags, so you can use you're IDE's javadoc auto- +# complete and copy-paste. Namespaces also can be used for method arguments if they're from PMD. +# +# # * Defining custom namespaces # * you can define a namespace pointing to a package name relevant to what # you're documenting to save some keystrokes. @@ -42,18 +52,13 @@ require_relative 'jdoc_namespace_tag' # jdoc tags or other jdoc_nspace tags. E.g. # {% jdoc coreast::Node %} -> points to pmd-core, expanded to 'net.sourceforge.pmd.lang.ast.Node' # {% jdoc jmx::impl.NcssVisitor %} -> points to pmd-java, expanded to 'net.sourceforge.pmd.lang.java.metrics.impl.NcssVisitor' -# -# * To reference a method or field: {% jdoc core::Rule#addRuleChainVisit(java.lang.Class) %} -# * The suffix # is followed by the name of the method or field -# * The (erased) types of method arguments must be fully qualified. This is the same -# convention as in javadoc {@link} tags, so you can use you're IDE's javadoc auto- -# complete and copy-paste. Namespaces also can be used for method arguments if they're from PMD. -# -# * To reference a package: eg {% jdoc_package core::properties %} # * If you want to reference the package prefix of a namespace, you can do so # by using the syntax ':nspace', e.g. -# {% jdoc_package :jmx %} -> points to pmd-java, expanded to 'net.sourceforge.pmd.lang.ast.Node' -# {% jdoc_package :coreast %} -> points to pmd-core, expanded to 'net.sourceforge.pmd.lang.java.metrics' +# {% jdoc_package :jmx %} -> points to pmd-java, expanded to 'net.sourceforge.pmd.lang.java.metrics' +# {% jdoc_package :coreast %} -> points to pmd-core, expanded to 'net.sourceforge.pmd.lang.ast' +# * This is especially cool because it allows you to assign a namespace to a type name and then add a method suffix, eg +# {% jdoc_nspace :PrD core::properties.PropertyDescriptor %} +# {% jdoc :PrD#description() %} # # * Bang options: # * The visible text of the link may be customized by prefixing the reference to the @@ -61,25 +66,25 @@ require_relative 'jdoc_namespace_tag' # * Option syntax is "!opts!", and prefixes the namespace. Options are one-character switches. # * Available options: # * No options -> just the member name: -# * {% jdoc @.Rule %} -> [`Rule`](...) -# * {% jdoc @.Rule#setName(java.lang.String) %} -> [`setName`](...) -# * {% jdoc @.AbstractRule#children %} -> [`children`](...) +# * {% jdoc core::Rule %} -> [`Rule`](...) +# * {% jdoc core::Rule#setName(java.lang.String) %} -> [`setName`](...) +# * {% jdoc core::AbstractRule#children %} -> [`children`](...) # * a (args) -> adds the simple name of the argument types for method references, noop for other references -# * {% jdoc !a!@.Rule#setName(java.lang.String) %} -> [`setName(String)`](...) +# * {% jdoc !a!core::Rule#setName(java.lang.String) %} -> [`setName(String)`](...) # * q (qualify) -> prefix with the fqcn of the class, noop for package references -# * {% jdoc !q!@.Rule %} -> [`net.sourceforge.pmd.Rule`](...) -# * {% jdoc !q!@.Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.Rule#setName`](...) +# * {% jdoc !q!core::Rule %} -> [`net.sourceforge.pmd.Rule`](...) +# * {% jdoc !q!core::Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.Rule#setName`](...) # * c (class) -> prefix the class name for member references, noop for type and package references, or if "qualify" is specified -# * {% jdoc !c!@.Rule#setName(java.lang.String) %} -> [`Rule#setName`](...) +# * {% jdoc !c!core::Rule#setName(java.lang.String) %} -> [`Rule#setName`](...) # * Empty options ("!!") - > shorthand to a commonly relevant option # * For field or method references, "!!" is the "c" option -# * {% jdoc !!@.Rule#setName(java.lang.String) %} -> [`Rule#setName`](...) +# * {% jdoc !!core::Rule#setName(java.lang.String) %} -> [`Rule#setName`](...) # * For type references, "!!" is the "q" option -# * {% jdoc !!@.Rule %} -> [`net.sourceforge.pmd.Rule`](...) +# * {% jdoc !!core::Rule %} -> [`net.sourceforge.pmd.Rule`](...) # * For package references, "!!" is a noop, they're always fully qualified # * Several options may be used at once, though this is only useful for method references: -# * {% jdoc !ac!@.Rule#setName(java.lang.String) %} -> [`Rule#setName(String)`](...) -# * {% jdoc !aq!@.Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.Rule#setName(String)`](...) +# * {% jdoc !ac!core::Rule#setName(java.lang.String) %} -> [`Rule#setName(String)`](...) +# * {% jdoc !aq!core::Rule#setName(java.lang.String) %} -> [`net.sourceforge.pmd.Rule#setName(String)`](...) # # * DO NOT: # - Include spaces in any part of the reference @@ -106,8 +111,8 @@ class JavadocTag < Liquid::Tag @type_fqcn = arr[0] @member_suffix = arr[1] || "" # default to empty string - unless Regexp.new('(!\w*!)?' + JDocNamespaceDeclaration::NAMESPACED_FQCN_REGEX.source) =~ @type_fqcn - "Wrong syntax for type reference, expected eg nspace::a.b.C, !!nspace::a.b.C, or !opts!nspace::a.b.C" + unless Regexp.new('(!\w*!)?' + Regexp.union(JDocNamespaceDeclaration::NAMESPACED_FQCN_REGEX, JDocNamespaceDeclaration::SYM_REGEX).source ) =~ @type_fqcn + fail "Wrong syntax for type reference, expected eg nspace::a.b.C, !opts!nspace::a.b.C, or :nspace" end # If no options, then split produces [@type_fqcn] @@ -166,7 +171,7 @@ class JavadocTag < Liquid::Tag if opts.show_args? && $2 && !$2.empty? # is method - args = $3.split(",").map {|a| a.gsub(/\w+\./, "").strip} # map to simple names + args = ($3 || "").split(",").map {|a| a.gsub(/\w+\./, "").strip} # map to simple names suffix = "#{suffix}(#{args.join(", ")})" end diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 1d741d4fd5..661a62b56b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -38,8 +38,6 @@ This is a {{ site.pmd.release_type }} release. * The implementation of the adapters for the XPath engines Saxon and Jaxen (package {% jdoc_package :xpath %}) are now deprecated. They'll be moved to an internal package come 7.0.0. Only {% jdoc xpath::Attribute %} remains public API. -{% jdoc !aq!core::lang.rule.stat.StatisticalRule#SIGMA_DESCRIPTOR %} - ### External Contributions @@ -50,5 +48,7 @@ This is a {{ site.pmd.release_type }} release. {% endtocmaker %} -{% include note.html content="The release notes of previous versions are available [here](pmd_release_notes_old.html)" %} +{% unless is_release_notes_processor %} + {% include note.html content="The release notes of previous versions are available [here](pmd_release_notes_old.html)" %} +{% endunless %} diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/properties/LongMultiProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/properties/LongMultiProperty.java index 827cbf2aa3..eb07bf17bc 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/properties/LongMultiProperty.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/properties/LongMultiProperty.java @@ -6,9 +6,7 @@ package net.sourceforge.pmd.properties; import java.util.Arrays; import java.util.List; -import java.util.Set; -import net.sourceforge.pmd.PMDConfiguration; import net.sourceforge.pmd.properties.builders.MultiNumericPropertyBuilder; import net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilderConversionWrapper;