We are using SonarQube 4.5.1 for our projects and are planning to provide list of rules activation/deactivation to end users.
What is best way to export/import within SonarQube in Excel?
There is option of backup in Quality Profile but it did not export description.
I looked directly in the database with rules table, but due to some HTML tag this is not working for delimited with semicolon.
I would also like to know how we can add customized rules to existing set of rules. What is the procedure?
The SonarQube interface is really going to be the best referential for your users. Based on the info in your comment, I'd suggest a simple web form rather than trying to construct a spreadsheet.
It may help to know that you can construct the URL to any rule using the repositoryKey and key returned in the XML profile backup:
http://[server]/coding_rules#rule_key=[repositoryKey]:[key]
E.G. https://sonarcloud.io/api/rules/search?rule_key=csharpsquid%3AS907
The API supports many parameters that are documented here: https://sonarcloud.io/web_api/api/rules/search (click the Parameters header above the horizontal line to open the descriptions).
For example, the languages parameter makes it possible to search for rules that apply to one or more languages (a comma-separated list). To get the list of all C# rules, you can use https://sonarcloud.io/api/rules/search?languages=cs
To export the Rules on JSON format:
For C++ rules you can use the URL:
http://<localhost:<port/>>api/rules/search?languages=c%2B%2B
For C rules you can use the URL:
http://<localhost:<port/>>api/rules/search?languages=cs
After saving result of search API in json file, to cover entirely the question, import of json result in excel can be done with https://github.com/VBA-tools/VBA-JSON
Related
i was trying to understand in the Kentico's database model how can i change the web parts content using a database script.
So, basically i have a website based on Kentico with several articles, and internal hyperlinks in its content. But the problem is that the format of those hyperlinks are actually invalid. And i was looking for a way to build a script and do a bulk-update in order to replace some characters and update those hyperlinks to the valid format.
Any idea how can i build the query to get the content of all web parts used in all published pages.
Thank you
It depends on your web parts and how the content is rendered. There are different ways that web parts render their content:
The web part layout is used for markup
The ASCX file for the web part is used for markup
The web part makes use of a repeater that uses a Transformation to render the markup- The markup is generated in code behind
The last one can be tricky to change depending on the web part and whether you have access to all the code behind, but the others you can change either in code in your solution or within the Administration area itself.
Doing this in SQL would probably require a combination of T-SQL XML support and regular expressions to find what you're looking for. you effectively need to look in the CMS_WebPart and CMS_WebPartLayout tables to find what you're looking for.
However, reading your query, I'm not 100% sure you're talking about web parts, (my apologies if you are) as you talk about links in the article content itself. If these are set using the Editable text web part, then you need to look in the CMS_Document table at the DocumentContent field to find the links to replace. But you then need to look at how to correctly format those links going forward so that you do not need to repeat this process later.
Note:
You need to be really careful when doing this in SQL to make sure that you don't create invalid XML. Things go bad when you do that.
This won't flush your cache, so you'll need to clear your cache manually afterwards.
If you're using out-of-the-box web parts, you should really make a copy of them and use the copy if you're going to modify, this way, you're less likely to have pain in future upgrades.
Typically "content" is not set in a webpart. Webparts are configured to retrieve content from page types. There is an exception to this with specific webparts like Editable Text, Static Text, Static HTML, etc.
The configuration of a webpart is stored at the template level in the cms_pagetemplate table. The configuration for ALL webparts on that page template are stored in the PageTemplateWebParts field. So you'd have to parse through the XML and get the proper webpart and then perform an update on that field. You maybe able to do a regex to find that content and replace it as well.
Not ideal to do this via SQL simply because of version history and it can cause a lot of problems later on. I'd suggest finding out which API calls you can make to perform these updates and write a small program for it.
Is there a way to build a ruleset in codeeffects from a string? The default way over the ASP/MVC RuleEditor is currently not an option.
You need to use RuleXML if you want to build your rules dynamically outside of our editor. It's a common way of creating rules in Code Effects. String representation is too generic to be useful in rule generation. Details on RuleXML can be found here.
Also, please take a look at SourceXML; it allows you to generate your source objects dynamically, too. This is a MUCH more flexible approach for source handling that plain .NET objects. Details can be found here.
We have a requirement for creating a banner for which we plan to use Web Content Display.
As part of the implementation I have created a structure with the required fields like link-type (drop-down), etc and using corresponding template.
I wish to make a conditional check based on the type of selection in the link-type and show link-to-page or text-box.
I observed that there is no option to have a conditional check in the article editor rendering.
Thus I wish to check whether there is any hack or trick that we can do to achieve the above conditional thing?
Also, can we inject custom Javascript to achieve this as part of the structure?
I finally have to stick to the default options in the liferay structure. I plan to use separator provided by LR to categories the elements to avoid end user (admin) confusion.
P.S. I was not able to locate any cool doc that would help in implementing the suggestion made by #Tobias (sorry, but I guess the wiki link above assumes you to be an expert of LR, and even the sample links in there does not work).
I would like to "customize" my sharepoint wiki by doing something very simple.
I would like to be able to run a regex on wiki pages looking for [math] and [\math] tags, then take the expression written in the middle (assume this value is stored in a variable x) and replace the whole block by
"<img src='http://latex.codecogs.com/gif.latex?" + x +"'/>"
So for example, the shortcode [math]a^2+b^2=c^2[\math] should end up being displayed as an image as follows (thanks to this online tool):
I have never developed anything in sharepoint, and I've been using it for a week.
Can anybody tell me how I should proceed to add such a feature (if it's possible)?
You can use existing solution like ShortPoint.
Sure - this is simmply done via two methods - 1) You could modify the page directly using SharePoint designer - fly in the code where you want it, 2) The better way - add your code to text file, upload the text file to a document library then use the Content Editor web part, drop it on the page, point it (through the properties) to the text file.
Note: The Content Editor part will allow you to modify the background HTML/Script, however, it has a nasty habit of overriding your code and I've had it actually duplicate itself (adding repeat scripts). Using the Text file eliminiates that issue.
If i understand you correctly, I don't think that the content editor web part is the solution you are looking for. I believe you are wanting to implement a shortcodes solution such as that found in WordPress, correct? In that case, the issue becomes a bit more complex. To really get any kind of custom code that would execute at the necessary stages, you would need a custom solution either implementing additional functionality in the existing rich text editor, or roll your own custom rich text editor.
At that point, you would have complete control over how the content is parsed and interpreted, so you could have both server-side and client side processing. You could make use of templating engines like mustache or handlebars.
To do this, you would need to write your own Custom field type, inherit from SPFieldMultiLineText, override the property FieldRenderingControl, and return your custom control. That way you have the option of implementing it in several different places (custom pege fields in a page layout, custom webparts, custom lists, etc.) and you still get the benefits you want from the out-of-the-box control.
Is it possible to use more complicated layer url rule matching syntax? I want to be able to choose the layer to display based on a more regex type rule that matches the rules I have set up in my custom routing for my module.
I would like to be able to acheive something along the lines of:
url('~/my-{\w*}/something/{\w*}')
It's not available ootb, but could be pretty easy to implement yourself in a custom module (if you don't want to alter the core code).
It can be implemented as a slight modification to existing Orchard.Widgets.RuleEngine.UrlRuleProvider, so regexes would be also taken into account.
Just create an implementation of IRuleProvider, name your function as eg. 'urlregex' (so it wouldn't collide with the existing 'url', processed by UrlRuleProvider) and do all the processing stuff inside Process(RuleContext ruleContext) method. It's a very simple class to implement and would involve just a few lines of code - take a look at the default url rule provider I mentioned at the beginning.