PMD rule for checking html/jsp files - pmd

I´d like to create a PMD rule that checks for a regex expression in any file (txt, html, jsp, etc.). The rule does not use Java or XPath structure.
The idea is to read the file and add violations according to the line analyzed. I don´t know how to do this using Rule methods...
Any idea?
Thanks,
Andre

You would have to create a Java run that looked for a property containing the regex. It should be fairly straight forward. Extend AbstractRule so in say Rule.start you could use the RuleContext.getSourceCodeFile() to retrieve the file, load it and run your regex over it.

Related

Is there a way to use babel plugins relying ont he current filename with babel-loader?

I wrote a plugin for babel that relies on the opts.filename and opts.filenameRelative properties. It seems to be working within babel-loader for the purposes of analyzing the adjacent files, but the filename itself seems to be modified.
I'm wondering if theres a way, using babel-loader, to get access to the full source file path to use for generating a legible id and hash.
babel-loader does indeed pass the filename into the transform function. In my particular case, I was preprocessing typescript files with awesome-typescript-loader, and that was messing with the file path.

Can we use wildcards based searching in Monodevelop?

I want to find and edit Debug statements in my file. I would like to know if I can edit all those files simultaneously using wildcards in the replace function of MonoDevelop.
MonoDevelop offers a search based on regex (not wildcards):
You can use it to search things such as Debug\.Log.+ which will match things like:
Debug.LogError
Debug.LogWarning

Best way to compare projects on Enterprise Architect

I want to know if there is a way to see the changes I made it to a linked files when I compare a project against a base line or a file to file.
I tried the compare utility from base line and file to file comparassion, and its works, if I add a linked file to x component or edit an existing one, it shows that there is change, but not in the best o most readeable way.
There is another way or tool to acomplished that?
Thank you.
pd_ sorry for my bad english
You can
Write your own comparison engine
Export the comparison xml and use that to present it in a way you like it better
Use LieberLiebers Lemontree

How to use wildcards in nant xmlpoke file path

I am using the xmlpoke task in nant and am looking for a way to use a wildcard when addressing the xml file. Right now I have a file path like project\appFiles\project{versionNumber}\fileToUpdate.xml, I would like to use a wildcard so its something like project\appFiles\project*\fileToUpdate.xml so I don't have to update the version number every time.
How do you get it to respect wildcards?
Looking all over the web, it doesn't look like this is possible, and by design. Like copy command (todir), the file path must point to a single file so no wildcards allowed (Found info on copy command, assuming same applies for XMLPoke, but could confirm exactly).
I ended up changing some design stuff so now the version number is easily calculated by the program calling the script, so passing in not an issue anymore.

Word 2010 additional file format

I'm not sure whether this is the best approach for this or whether I perhaps should ask the question more clearer.
What I want to do is to create an additional file output - e.g. if the user uses Word to create a description consisting of known tags, I want to be able to save this as bbcode.
Now I do have an idea of how to do this, but is there a way to say add another file format to the "Save file"-dialog box and have it run a parser and file writer, that'd read the current document and export it using known bbcode-tags (that perhaps would be adjustable from some configuration window)?
The result would be a file containing bbcode as well as the text information that the user has entered.
How would I hook up my addin to the file output dialog? Is there a way to do this? I'm not sure it's custom XML since I won't be using the XML at all.
Thanks in advance and please excuse my poor English.
Edit: after having a look at the Word 2010 AddIn-project, I figured, that I'm looking for a way to define my own "export"-format. I'd like to export the BBCode to a .txt (or even .bbcode) file. The Microsoft.Office.Interop.Word.WdExportFormat seems to have its own fixed enumeration. Is there a way to add an export-format?
There is some code for this here:
phpbb.com/community/viewtopic.php?f=17&t=395554