rule failed test while trying to upgrade pmd from 6.17.0 to 6.18.0 - pmd

the rule is
"//Reference[matches(#literal, \"^\$[^!]+\") and ./preceding-sibling::Text and ./following-sibling::Text]"
for your convenient I will provide the project and you can mvn-test it.
the whole project is at https://github.com/XenoAmess/p3c/tree/1605f4d1b9c6a505074be5328953af26f578e190/p3c-pmd
the Rule class is com.alibaba.p3c.pmd.lang.vm.rule.other.UseQuietReferenceNotationRule
I tried to look through your update log, and found nothing related.
Thanks for help.

That's a side-effect of fixing https://github.com/pmd/pmd/issues/1923. It has been fixed by using real/full name in the rule context (see https://github.com/pmd/pmd/pull/1982). In unit tests, the file name used is "n/a", which is now interpreted as the file "a" in directory "n". RuleContext::getSourceCodeFilename returns just the filename and not the full path. To retrieve the full path RuleContext::getSourceCodeFile can be used.
Your rule UseQuietReferenceNotationRule checks the filename (UseQuietReferenceNotationRule.java:65) which is now not "n/a" anymore in the unit tests but "a". You can "fix" the unit test by simply changing UT_FILE_NAME to "a" (see UseQuietReferenceNotationRule.java:45).
Alternatively you can change the rule to use ctx.getSourceCodeFile().toString() to recover the full pathname in UseQuietReferenceNotationRule.java:62. Although the file doesn't exist, it still points to "n/a".
An alternative for checking the path names in the rule itself might be File exclusion/inclusion patterns.
Also, contributions on https://github.com/pmd/pmd are welcome if you think the rules make sense for a wider audience.

Related

distilbert model is not working at ktrain

I tried to use distilbert classifier. but I am getting the following error.
This is my code
(X_train,y_train),(X_test,y_test),prepro
=text.texts_from_df(train_df=data_train,text_column="Cleaned",label_columns=col
,val_df=data_test,maxlen=500,preprocess_mode="distilbert")
and here is the error
OSError: Model name 'distilbert-base-uncased' was not found in tokenizers model name list (distilbert-base-uncased, distilbert-base-uncased-distilled-squad, distilbert-base-cased, distilbert-base-cased-distilled-squad, distilbert-base-german-cased, distilbert-base-multilingual-cased). We assumed 'distilbert-base-uncased' was a path, a model identifier, or url to a directory containing vocabulary files named ['vocab.txt'] but couldn't find such vocabulary files at this path or url._
Due to my office current environmental issue, I can only work on tf 2.2 and python 3.8. Right now I am using 0.19.
Do you think it will affect my current environment if I downgrade it to 0.16?
This error may happen if there is a network or firewall issue preventing download of the tokenizer files. See this FAQ entry for remedies.
Also, when you use preprocess_mode='distilbert', texts_from* functions return TransformerDataset instances, not arrays. You'll need to replace (X_train, y_train) with train_data, for example. See this example notebook.

Eclipse XML Validation - how to exclude certain files?

Since the reactions in the Eclipse WTP forum were not really helpful I try to maybe get an answer here:
In our test folders we have a couple of (purposely) faulty XML files.
EACH and EVERY time I do a full rebuild these are flagged as validation errors!
No matter what I specify in Preferences -> Validation -> XML Validation -> Settings under "Exclude Group: these files keep getting validated and hence flagged as build errors and this is mighty annoying!
What syntax is expected for a "Folder or Filename" rule?
Our faulty testfiles are named like "Filename-01.xml" to "Filename-30.xml" but strings like "Filename*.xml" or "Filename*" (with or without the case sensitive flag checked) obviously don't match. Whether specifying the full pathname or just the directory-local name or even trying with RegEx syntax (i.e. "Filename.*") didn't make any difference.
What is the secret sauce to get this "Exclude Group" working?
Or is this simply a bug that we have to live with (because I have little hope that this will ever get fixed...)?

FlexUnitApplication.html and FlexUnitApplication.swf not generated

Context
I have
a project Flex-Java in Eclipse Indigo service Release 2, (a web application)
and i use the plugin Flash-builder to work on it.
I use sdk 4.5.1
What i try to do
1) I try to make a simple test case with FlexUnit4. When i create a new Test Case) : New > Test Case Class, Eclipse by Default create :
package flexUnitTests + with my new Test case : (for example :
TestDoc.as)
package byDefault with one file : FlexUnitCompilerApplication.mxml
a html a swf file for FlexUnitCompilerApplication is auto-generated in bin-debug folder.
Till this point all seems to be good, so I try to execute the unit test :
2) I want to execute the unit test :
A FlexUnitApplication.mxml is created in the default package
The problem :
The compilator doesn't generate the files : FlexUnitApplication.hmtl and FlexUnitApplication.swf in bin-debug folder...
And there is an error written in the "error screen" :
description Impossible to resolve all the ressources "FlexUnitTestRunner"
place or Localisation : Unknown
sorry i try to translate the description from a French version
Other informations
I succeeded doing this in other projects... the FlexUnitApplication files are auto-generated.
Question(s)
It seems that, it is bound with something in this particular project. Maybe something is hindering the process to autogenerate these files ?? I cannot figure it out why??
Is it Possible to force the compilator doing these files (html and swf) ??
I am really lost.. and i tried things, i looked in the properties, in the metadata's ... i really don't understand.
Somebody maybe has an idea for that, what could i do, what could i check ?
Thank you in advance
I always have troubles with unit tests in eclips+FB plugin as well.
After the FlexUnitApplication.mxml is created goto your project settings and update the following:
remove the dynamic {locale} compiler flag and add a specific '-locale=en_US' only.
if you have custom locale files add those to the source path manually
in the library path find the entry that points to the dynamic locale library '..sdk/../{locale} and copy the path. click on add SWC to library path. Paste the copied path and replace '{locale}' with 'en_US'
Generally this turns out favorable for me.

SSRS Deployment complaining about path length when my path is short

I am attempting to deploy my SSRS solution. I have set the "TargetReportFolder" property of my project to "Reports"
When I right-click and select "Deploy", I get the following error:
The path of the item '/Reports' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash.
Obviously my path is less than 260 characters long. I've tried setting my TargetReportFolder property to "/Reports", to the name of my project, and to the name of my project with a slash at the beginning - all give the same error.
I don't understand this deployment process very well. Can someone help me understand?
(I also feel like this may not be on topic, but was encouraged by the presence of an SSRS tag)
My problem was that I didn't understand how Reporting Services works with SharePoint. My comment above is incorrect, I did need to deploy, but I had the wrong parameters for my properties. This page helped me:
http://msdn.microsoft.com/en-us/library/bb283155.aspx
The key takeaways from this article are:
All Target*Folder properties need to be either a URL to a document library, or empty
If they are empty, they take the value of TargetReportFolder, which can't be empty and must be a URL to a document library
TargetServerURL needs to be the URL of the site collection in SharePoint

waf copy a file from source tree to the build tree

I have the following snippet, to copy a file as-is to the build dir:
for m in std_mibs:
print("Copying", m)
bld(name = 'cpstdmib',
rule = 'cp -f ${SRC} ${TGT}',
#source = m + '.mib',
source = bld.path.make_node(m + '.mib'), # <-- section 5.3.3 of the waf book
target = bld.path.get_bld().make_node(m + '.mib')
)
I see that this rule, though hit (from the print), the copy doesnt seem to be happening!
I also changed the source to use the make_node as shown, in an example in the section 5.3.3 of the waf book, still no luck! Am I missing something obvious here!?
Also, I have some rules after this, which rely on the copied files, and I tried adding
an intervening
bld.add_group()
I hope that the sequencing will work, if this copy succeeds
If you run the rule once, it will not be run again until source is updated. This is true even if the target is deleted, for instance (which is probably how you were testing.)
If you want to recopy if the target is deleted, you will need always=True, or you'll need to check for existence and set target.sig = None.
Two alternatives:
features="subst" with is_copy=True:
bld(features='subst', source='wscript', target='wscript', is_copy=True)
waflib.extras.buildcopy like this:
from waflib.extras import buildcopy
#...
def build(bld):
bld(features='buildcopy',buildcopy_source=['file'])
cp is not platform independent.
A task_gen object is created, which later will become a Task, that will be executed before process_sources. Don't expect an immediate effect.
Have a look into your out dir, there will be out/${TGT} (not exactly, but ${TGT} path relative to your top directory)
This is totally to be expected behaviour, since you do not want to modify your source tree when building.