Configure the behaviour of R linters in Sublime 3 - json

I am using lintr in Sublime 3 via SublimeLinter 3 and the SublimeLinter-contrib-lintr plugin. On the lintr README.md file there is a short mention on how to configure what linters should be used:
{
"user": {
"linters": {
"r": {
"linters": "with_defaults(line_length_linter(120))"
}
}
}
}
However, I am using it in conjunction with SublimeLinter-contrib-lintr and I can't get it to work. My SublimeLinter.sublime-settings file looks like this:
{
"user": {
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"lintr": {
"#disable": false,
"args": [],
"cache": "TRUE",
"excludes": [],
"linters": "default_linters"
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": [
"C:/Program Files/R/R-3.3.3/bin/x64"
]
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"r extended": "r"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
The lintr package has a bunch of linters (see this link). What I would live to achieve is to discard some of them (i.e., not use, for instance, assignment_linter). Do you have any idea how to achieve this? It should be possible, right?
Edit 1:
I noticed that by changing "linters": "default_linters" to "linters": "assignment_linter", only the errors falling under assignment_linter will be picked. I tried to expand it using an array, but it doesn't work:
...
"lintr": {
"#disable": false,
"args": [],
"cache": "TRUE",
"excludes": [],
"linters": [
"assignment_linter",
"object_name_linter"
]
}
...
Inside the Sublime 3 console, the message error message with this attempt is: Error: unexpected '[' in "lint(cache = TRUE, commandArgs(TRUE), [".
Edit 2: possible solution
Looking at with_defaults inside the lintr package I found two ways of choosing only the linters I am interested in. Assuming that I only want assignment_linter and no_tab_linter, the configuration is:
"linters": "default_linters[c('assignment_linter', 'no_tab_linter')]" or
"linters": "with_defaults(assignment_linter, no_tab_linter, default = NULL)"
It works, but are there other less error-prone approaches? With this approach if I want to discard just one linter I have to list all the others.

Regarding your question for "Edit 2", you can discard a single linter as follows:
{
"user": {
"linters": {
"r": {
"linters": "with_defaults(some_default_linter = NULL)"
}
}
}
}
... where some_default_linter is the name of a linter from the list lintr::default_linters.

Related

Issue while creating a job for AWS Elemental media convert

I am having some issue while creating a job for AWS Elemental media convert.
I have followed the following sequence.
1.) Create a new job
2.) Add input and configurations
3.) Add File output group and configure destination settings
4.) Under Output change Container to No Container
5.) Under Output remove Audio
6.) Under Output -> Video change Codec to JPEG to Frame Capture
7.) Configure frame rate (rate which captures will be produced (more notes and examples below))
8.) Configure max capture settings
I got the following error:
Job_contains_the_following_error:
/outputGroups: Should not match the schema
Here is my job JSON:
{
"Settings": {
"AdAvailOffset": 0,
"Inputs": [
{
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"TimecodeSource": "EMBEDDED",
"VideoSelector": {
"ColorSpace": "FOLLOW",
"Rotate": "DEGREE_0"
},
"AudioSelectors": {
"Audio Selector 1": {
"Offset": 0,
"DefaultSelection": "DEFAULT",
"ProgramSelection": 1
}
},
"FileInput": "s3://field-live-user-data/udariyan.mp4"
}
],
"OutputGroups": [
{
"Name": "File Group",
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://field-live-user-data/"
}
},
"Outputs": [
{
"VideoDescription": {
"ScalingBehavior": "DEFAULT",
"TimecodeInsertion": "DISABLED",
"AntiAlias": "ENABLED",
"Sharpness": 50,
"CodecSettings": {
"Codec": "FRAME_CAPTURE",
"FrameCaptureSettings": {
"FramerateNumerator": 30,
"FramerateDenominator": 100,
"MaxCaptures": 2,
"Quality": 80
}
},
"DropFrameTimecode": "ENABLED",
"ColorMetadata": "INSERT",
"Width": 1280,
"Height": 720
},
"ContainerSettings": {
"Container": "RAW"
},
"Extension": "jpg"
}
],
"CustomName": "customGroup"
}
]
},
"Queue": "arn:aws:mediaconvert:us-east-1:469030323850:queues/Default",
"Role": "arn:aws:iam::469030323850:role/myMediaConverter"
}
Currently, you can't have a job template with frame capture only:
AWS Dev forums on this topic

How Do I Display Non-Lit Material + Texture Using LMV Toolkit Specification or a Autodesk Material Library Material?

I'm unable to successfully display a model+texture map WITHOUT the viewer applying lighting effects to it.
I am using a localised version of the viewer to investigate the problem but I welcome an Autodesk Material Library setting solution if it exists.
This is an example of how I want to see the material, i.e. no specular, no reflections (ignore the fact this example is in three.js): https://stemkoski.github.io/Three.js/Texture-Repeat.html
This is an example of my problem: https://myhub.autodesk360.com/ue29c31db/g/shares/SHabee1QT1a327cf2b7a7879b97973545818?viewState=NoIgbgDAdAjCA0IBGMAsBmATAMwKYBMBaCAQwHYBjQ1fATlUNt13UO1pIwDYZMAOTCVogAukA
I have attempted many different "Autodesk Material Library" settings, including ramping up "Self Illumination" however, the texture either fails to load and/or, that glossy shine persists.
Could the Materials.json be tweaked to fix this problem?
This is my Materials.json
{
"name": "LMVTK Simple Materials",
"version": "1.0",
"scene": {
"SceneUnit": 8214,
"YIsUp": 2
},
"materials": {
"0": {
"version": 2,
"userassets": ["0"],
"materials": {
"0": {
"tag": "0",
"proteinType": "",
"definition": "SimplePhong",
"properties": {
"integers": {
"mode": 4
},
"booleans": {
"color_by_object": false,
"generic_is_metal": false,
"generic_backface_cull": false
},
"scalars": {
"generic_transparency": {
"units": "",
"values": [0]
}
},
"colors": {
"generic_diffuse": {
"values": [{
"r": 1,
"g": 1,
"b": 1,
"a": 1
}]
}
}
},
"transparent": false,
"textures": {
"generic_diffuse": {
"connections": ["1_generic_diffuse"]
}
}
},
"1_generic_diffuse": {
"tag": "0",
"definition": "UnifiedBitmap",
"properties": {
"scalars": {
"unifiedbitmap_RGBAmount": {
"units": "",
"values": [1]
}
},
"uris": {
"unifiedbitmap_Bitmap": {
"values": ["image0.jpg"]
}
},
"booleans": {
"texture_URepeat": true,
"texture_VRepeat": true,
"unifiedbitmap_Invert": false
},
"integers": {
"texture_MapChannel": 1
}
}
}
}
}
}
}
I recommend trying this approach. Literally bypass the LMV materials (which are all effected by lighting) and use a custom THREE material that is not effected by lighting. You may possibly need to create a custom shader too.
Start with this...
https://forge.autodesk.com/cloud_and_mobile/2016/02/custom-transparent-meshes-with-view-data-api.html
Let me know if that fixes the problem, and if not I can deep dive into it further.
Best, Michael

How to get specified values from ansbile facts

I'm confused a little bit.
I alredy tried jmespath, but didn't help.
I need to get a high-level object which contains a specified object.
In the example below we see an ansible fact about HDDs. I need to get the disk name (sdf, sdg or dm-0) of the HDD which contains a specified partition, e.g. sdf1.
I've got this jmespath query:
msg.*.[partitions.sdf1]
but it just shows me all inside sdf1. Filters like [?partitions=="sdf1"] don't work here,
so the question is: how to preserve the whole sdf object in my example?
thanks in advance!
{
"msg": {
"sdf": {
"partitions": {
"sdf1": {
"holders": [],
"links": {
"ids": [
"17101686F123-part1",
"wwn-0x123456-part1"
]
},
"sectors": "1875380224"
}
},
"removable": "0",
"rotational": "0"
},
"sdg": {
"partitions": {
"sdg1": {
"holders": [],
"links": {
"ids": [
"164414123CEB-part1",
"wwn-0x1233451234831ceb-part1"
]
},
"uuid": "F301-FA7F"
}
},
"removable": "0"
},
"dm-0": {
"holders": [],
"host": "",
"links": {
"ids": [],
"uuids": []
},
"vendor": null,
"virtual": 1
}
}
}
This should work:
msg.*.{value: #, condition: partitions.sdf1}[?condition].value
explanation
At first we create a temporary object For each HDD object: {value, condition}. condition will be null if partitions.sdf1 doesn't exist on the corresponding HDD (sdf, sdg dm-0) object. If partitions.sdf1 exists, condition will contain that object, that is:
"condition": {
"holders": [],
"links": {
"ids": [
"17101686F123-part1",
"wwn-0x123456-part1"
]
},
"sectors": "1875380224"
}
Using [?condition] you filter out all objects where condition is null. Finally, we extract the actual value using .value

How to add parameters to CFLint rule

I want to set specific parameters for the built-in CFLint rules using CFLint 1.2.3. Unfortunately, there is currently no clear description how to do that.
So I tried to set them in different ways within the configuration having a look at the project test files and the provided JSON schema:
As defined in one of the test files:
{
"rule" : [
{
"name": "VariableNameChecker",
"className": "VariableNameChecker",
"message": [
{
"code": "VAR_TOO_SHORT",
"severity": "INFO",
"messageText": "Variable ${variable} SHORTER THAN ${MinLength}!"
}
],
"parameter": [
{
"name": "MinLength",
"value": "5"
}
]
}
],
"inheritParent" : true
}
Within the rule object:
{
"rule": [ ],
"excludes": [ ],
"includes": [
{
"code": "VAR_TOO_SHORT",
{
"parameter": {
"MinLength": "5"
}
}
}
],
"inheritParent": false
}
As separate global property:
{
"rule": [ ],
"excludes": [ ],
"includes": [
{
"code": "VAR_TOO_SHORT",
}
],
"parameter": {
"MinLength": "5"
}
"inheritParent": false
}
I also tried different naming conventions as parameter name like VariableNameChecker.MinLength and also writing parameters instead of parameter, though without luck.
What is the correct syntax to specify the parameters?
The only ways to override a plugin param prior to CFLint 1.3.0 are
(1) replace the cflint.definition.json file with your own
(2) set a system property in the form ClassName DOT parameter. for example:
java -DVariableNameChecker.MinLength=5 cflint-1.2.3-all.jar -file
In CFLint 1.3.0 the following will work:
{
"parameters" : {
"VariableNameChecker.MinLength": "5"
}
}

Using fnRender with ajax source datatable

I was trying just modifying one of the examples to do customize a cell:
var oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "sources/deep.txt",
"aoColumns": [
{ "mDataProp": "engine" },
{ "fnRender": function( oObj ) {
return "Test";
} },
{ "mDataProp": "platform.inner" },
{ "mDataProp": "platform.details.0" },
{ "mDataProp": "platform.details.1" }
]
} );
Which uses a source like:
{ "aaData": [
{
"engine": "Trident",
"browser": "Internet Explorer 4.0",
"platform": {
"inner": "Win 95+",
"details": [
"4",
"X"
]
}
},
...
...
Data is displayed correctly but I started getting "DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0"
Anything I'm missing? Or I should be doing this in a different way?
With help of official support I found the answer:
An additional parameter needs to be defined in order to avoid that alert:
{ "sDefaultContent": "",
"fnRender": function( oObj ) {
return "Test";
} }
http://datatables.net/forums/discussion/9030/using-fnrender-with-ajax-source-datatable#Item_1
Are you sure thatyour error isn't here
{ "mDataProp": "platform.details.0" },
{ "mDataProp": "platform.details.1" }
that should be
{ "mDataProp": "platform.details[0]" },
{ "mDataProp": "platform.details[1]" }
since details is an array?