Dataset Viewer
Auto-converted to Parquet
hash
stringlengths
16
16
value
dict
prompt
listlengths
12
12
033b0baff52bb483
{ "callgraph": "[FindFiles->[Builder->[asOfTime->[inSnapshot],inPartitions->[inPartitions]]]]", "msg": "If there are no manifests, then entries should be `CloseableIterable.empty()`, not the manifest iterable. That doesn't need to be closeable.", "patch": "@@ -191,7 +191,10 @@ public class FindFiles {\n Snapshot snapshot = snapshotId != null ?\n ops.current().snapshot(snapshotId) : ops.current().currentSnapshot();\n \n- CloseableIterable<ManifestEntry> entries = new ManifestGroup(ops, snapshot.manifests())\n+ // snapshot could be null when the table just gets created\n+ Iterable<ManifestFile> manifests = (snapshot != null) ? snapshot.manifests() : CloseableIterable.empty();\n+\n+ CloseableIterable<ManifestEntry> entries = new ManifestGroup(ops, manifests)\n .filterData(rowFilter)\n .filterFiles(fileFilter)\n .filterPartitions(partitionFilter)", "summary": "Collect all data files in the manifest." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -98,7 +98,7 @@ public class IndexSpec\n Preconditions.checkArgument(metricCompression == null || COMPRESSION_NAMES.contains(metricCompression),\n \"Unknown compression type[%s]\", metricCompression);\n \n- this.bitmapSerdeFactory = bitmapSerdeFactory != null ? bitmapSerdeFactory : IndexIO.CONFIGURED_BITMAP_SERDE_FACTORY;\n+ this.bitmapSerdeFactory = bitmapSerdeFactory != null ? bitmapSerdeFactory : new ConciseBitmapSerdeFactory();\n this.metricCompression = metricCompression;\n this.dimensionCompression = dimensionCompression;\n }\n\nCodereview: ", "role": "user" }, { "content": "Does this mean `druid.processing.bitmap.type` will no longer work to set the default bitmap type? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -202,6 +202,16 @@ public class CompactionTask extends AbstractBatchIndexTask\n this.dimensionsSpec = dimensionsSpec == null ? dimensions : dimensionsSpec;\n this.metricsSpec = metricsSpec;\n this.segmentGranularity = segmentGranularity;\n+ if (granularitySpec == null && segmentGranularity != null) {\n+ this.granularitySpec = new UniformGranularitySpec(\n+ segmentGranularity,\n+ null,\n+ null,\n+ null\n+ );\n+ } else {\n+ this.granularitySpec = granularitySpec;\n+ }\n this.tuningConfig = tuningConfig != null ? getTuningConfig(tuningConfig) : null;\n this.segmentProvider = new SegmentProvider(dataSource, this.ioConfig.getInputSpec());\n this.partitionConfigurationManager = new PartitionConfigurationManager(this.tuningConfig);\n\nCodereview: ", "role": "user" }, { "content": "What happens if both segmentGranularity & granularitySpec are non-null? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -40,7 +40,7 @@ public class ArrayConcat {\n }\n final int leftSize = left != null ? left.size() : 0;\n final int rightSize = right != null ? right.size() : 0;\n- final List<T> result = new ArrayList(leftSize + rightSize);\n+ final List<T> result = new ArrayList<>(leftSize + rightSize);\n if (left != null) {\n result.addAll(left);\n }\n\nCodereview: ", "role": "user" }, { "content": "Minor side improvement to get rid or compiler warning. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -391,7 +391,9 @@ public class HoodieDeltaStreamer implements Serializable {\n ValidationUtils.checkArgument(!cfg.filterDupes || cfg.operation != Operation.UPSERT,\n \"'--filter-dupes' needs to be disabled when '--op' is 'UPSERT' to ensure updates are not missed.\");\n \n- this.props = properties != null ? properties : UtilHelpers.readConfig(fs, new Path(cfg.propsFilePath), cfg.configs).getConfig();\n+ this.props = properties != null ? properties : UtilHelpers.readConfig(\n+ FSUtils.getFs(cfg.propsFilePath, jssc.hadoopConfiguration()),\n+ new Path(cfg.propsFilePath), cfg.configs).getConfig();\n LOG.info(\"Creating delta streamer with configs : \" + props.toString());\n this.schemaProvider = UtilHelpers.createSchemaProvider(cfg.schemaProviderClassName, props, jssc);\n \n\nCodereview: ", "role": "user" }, { "content": "Let us make it flexible in HoodieMultiTableDeltaStreamer as well? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -73,7 +73,14 @@ public class ExprUtils\n } else {\n Chronology chronology = timeZone == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(timeZone);\n final Object value = originArg.eval(bindings).value();\n- origin = value != null ? new DateTime(value, chronology) : null;\n+ if (value instanceof String && StringUtils.isEmpty((String) value)) {\n+ // We get a blank string here, when sql compatible null handling is enabled\n+ // and expression contains empty string for for origin\n+ // e.g timestamp_floor(\\\"__time\\\",'PT1M','','UTC')\n+ origin = null;\n+ } else {\n+ origin = value != null ? new DateTime(value, chronology) : null;\n+ }\n }\n \n return new PeriodGranularity(period, origin, timeZone);\n\nCodereview: ", "role": "user" }, { "content": "This `StringUtils.isEmpty()` is a dangerously-named synonym of `isNullOrEmpty()`, although it won't make difference here, because of the `value instanceof String` check guaranteeing that the value is not null. Please prohibit this whole `org.apache.commons.lang.StringUtils` class on forbidden-apis level. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -191,7 +191,10 @@ public class FindFiles {\n Snapshot snapshot = snapshotId != null ?\n ops.current().snapshot(snapshotId) : ops.current().currentSnapshot();\n \n- CloseableIterable<ManifestEntry> entries = new ManifestGroup(ops, snapshot.manifests())\n+ // snapshot could be null when the table just gets created\n+ Iterable<ManifestFile> manifests = (snapshot != null) ? snapshot.manifests() : CloseableIterable.empty();\n+\n+ CloseableIterable<ManifestEntry> entries = new ManifestGroup(ops, manifests)\n .filterData(rowFilter)\n .filterFiles(fileFilter)\n .filterPartitions(partitionFilter)\nCodereview: ", "role": "user" } ]
c1752542d5b833d3
{ "callgraph": "[OpenTelemetryProtocolExporterEventSource->[FailedToReachCollector->[FailedToReachCollector],ExportMethodException->[ExportMethodException]]]", "msg": "Didn't went with backwards compatibility since it's still in beta", "patch": "@@ -26,11 +26,12 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation\n public static readonly OpenTelemetryProtocolExporterEventSource Log = new OpenTelemetryProtocolExporterEventSource();\n \n [NonEvent]\n- public void FailedToReachCollector(Exception ex)\n+ public void FailedToReachCollector(Uri collectorUri, Exception ex)\n {\n if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))\n {\n- this.FailedToReachCollector(ex.ToInvariantString());\n+ var rawCollectorUri = collectorUri.ToString();\n+ this.FailedToReachCollector(rawCollectorUri, ex.ToInvariantString());\n }\n }\n ", "summary": "FailedToReachCollector - Method failed to reach collector." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -194,8 +194,9 @@ namespace System.Text.Json\n }\n }\n \n+ [DoesNotReturn]\n [MethodImpl(MethodImplOptions.NoInlining)]\n- public static void ReThrowWithPath(in WriteStack writeStack, Exception ex)\n+ public static void ReThrowWithPath(in WriteStack writeStack, Exception? ex)\n {\n JsonException jsonException = new JsonException(null, ex);\n AddExceptionInformation(writeStack, jsonException);\n\nCodereview: ", "role": "user" }, { "content": "Same here. Remove nullability annotation? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -26,11 +26,12 @@ public class SynchronousUntilSuccessfulProcessingStrategy extends AbstractUntilS\n protected transient Log logger = LogFactory.getLog(getClass());\n \n @Override\n- public MuleEvent route(MuleEvent event) throws MessagingException\n+ protected MuleEvent doRoute(MuleEvent event) throws MessagingException\n {\n Exception lastExecutionException = null;\n try\n {\n+ MuleEvent retryEvent = DefaultMuleEvent.copy(event);\n for (int i = 0; i <= getUntilSuccessfulConfiguration().getMaxRetries(); i++)\n {\n try\n\nCodereview: ", "role": "user" }, { "content": "if this is a copy then this is not the originalEvent </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -5222,7 +5222,7 @@ namespace System.Tests\n }\n \n [Fact]\n- public static void ToLower()\n+ public static void ToLower_2()\n {\n var expectedSource = new char[3] { 'a', 'B', 'c' };\n var expectedDestination = new char[3] { 'a', 'b', 'c' };\n\nCodereview: ", "role": "user" }, { "content": "What is the other ToLower test this is conflicting with? \"ToLower_2\" isn't descriptive about what makes this test different from a presumed \"ToLower_1\", so we should either pick descriptive names or combine the tests. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -41,9 +41,9 @@ namespace System.Collections.Tests\n #region Constructors\n \n [Fact]\n- public void PriorityQueue_Generic_Constructor()\n+ public void PriorityQueue_DefaultConstructor_ComparerEqualsDefaultComparer()\n {\n- var queue = new PriorityQueue<TElement, TPriority>();\n+ var queue = new PriorityQueue<TPriority, TPriority>();\n \n Assert.Equal(expected: 0, queue.Count);\n Assert.Empty(queue.UnorderedItems);\n\nCodereview: ", "role": "user" }, { "content": "Was this a purposeful change? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -64,13 +64,13 @@ public class TestMemoryDirectory extends NXRuntimeTestCase {\n static final String SCHEMA_NAME = \"myschema\";\n \n @Override\n- @Before\n public void setUp() throws Exception {\n- super.setUp();\n-\n deployBundle(\"org.nuxeo.ecm.core.schema\");\n deployContrib(\"org.nuxeo.ecm.directory.core.tests\", \"test-schema.xml\");\n+ }\n \n+ @Override\n+ protected void postSetUp() throws Exception {\n MemoryDirectoryDescriptor descr = new MemoryDirectoryDescriptor();\n descr.name = \"mydir\";\n descr.schemaName = SCHEMA_NAME;\n\nCodereview: ", "role": "user" }, { "content": "- use of `deployContrib` with a test contribution </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -26,11 +26,12 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation\n public static readonly OpenTelemetryProtocolExporterEventSource Log = new OpenTelemetryProtocolExporterEventSource();\n \n [NonEvent]\n- public void FailedToReachCollector(Exception ex)\n+ public void FailedToReachCollector(Uri collectorUri, Exception ex)\n {\n if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))\n {\n- this.FailedToReachCollector(ex.ToInvariantString());\n+ var rawCollectorUri = collectorUri.ToString();\n+ this.FailedToReachCollector(rawCollectorUri, ex.ToInvariantString());\n }\n }\n \nCodereview: ", "role": "user" } ]
7dc3d2474c83cca7
{ "callgraph": "[replace,fieldRow,dispose,isShadow,utils,outputConnection,setAttribute,substring,name,Colours,stringify,map,require,WidgetDiv,DUMMY_INPUT,FieldTextInputRemovable,setCheck,provide,setShadow,Blocks,render,dom,setFieldValue,initSvg,appendChild,ScratchBlocks,parse,connection,INPUT_VALUE,Events,trim,type,getField,getFieldValue,getAttribute,createElement]", "msg": "Is this actually a lint related change?", "patch": "@@ -185,7 +185,7 @@ Blockly.ScratchBlocks.ProcedureUtils.removeAllInputs_ = function() {\n */\n Blockly.ScratchBlocks.ProcedureUtils.createAllInputs_ = function(connectionMap) {\n // Split the proc into components, by %n, %b, and %s (ignoring escaped).\n- var procComponents = this.procCode_.split(/(?=[^\\\\]\\%[nbs])/);\n+ var procComponents = this.procCode_.split(/(?=[^\\\\]%[nbs])/);\n procComponents = procComponents.map(function(c) {\n return c.trim(); // Strip whitespace.\n });", "summary": "Creates all inputs of a block and removes all inputs on the block including dummy inputs. function to populate the input." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -329,7 +329,7 @@ define([\n iso8601String = iso8601String.replace(',', '.');\n \n //Split the string into its date and time components, denoted by a mandatory T\n- var tokens = iso8601String.split('T'), year, month = 1, day = 1, hours = 0, minutes = 0, seconds = 0, milliseconds = 0;\n+ var tokens = iso8601String.split('T'), year, month = 1, day = 1, hour = 0, minute = 0, second = 0, millisecond = 0;\n \n //Lacking a time is okay, but a missing date is illegal.\n var date = tokens[0];\n\nCodereview: ", "role": "user" }, { "content": "I know it's kind of verbose, but we generally avoid multi-variable var statements like this, especially when there's initialization scattered throughout. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -21,10 +21,14 @@ var $buo = function() {\n document.getElementsByTagName('body')[0].classList.add(\"crawler\");\n var mainElement = document.getElementById(\"main\");\n var noscriptElements = document.getElementsByTagName(\"noscript\");\n- // noscriptElements[0].innerHTML contains encoded HTML\n- var innerHTML = noscriptElements[0].childNodes[0].nodeValue;\n- mainElement.innerHTML = innerHTML;\n-\n+ // find the element with the \"data-path\" attribute set\n+ for (var i = 0; i < noscriptElements.length; ++i) {\n+ if (noscriptElements[i].dataset[\"path\"]) {\n+ // noscriptElements[i].innerHTML contains encoded HTML\n+ mainElement.innerHTML = noscriptElements[i].childNodes[0].nodeValue;\n+ break;\n+ }\n+ }\n // retrieve localized browser upgrade text\n var t = <%= \"'\" + I18n.t('js.browser_update') + \"'\" %>;\n \n\nCodereview: ", "role": "user" }, { "content": "How is this a `find`? Looks like you're just iterating over all the items? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -25,13 +25,13 @@ searchDataRequest.onload = function() {\n searchData.forEach(function(page) {\n index.add(page);\n });\n- postMessage({ e: 'index-ready' });\n+ postMessage({e: 'index-ready'});\n };\n searchDataRequest.open('GET', 'search-data.json');\n searchDataRequest.send();\n \n // The worker receives a message everytime the web app wants to query the index\n-onmessage = function(oEvent) {\n+self.onmessage = function(oEvent) {\n var q = oEvent.data.q;\n var hits = index.search(q);\n var results = [];\n\nCodereview: ", "role": "user" }, { "content": "Ooc, couldn't this also be `self.postMessage`? Is there any reason why you usd it below but not here (just being curious)? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -348,6 +348,7 @@ function shallowClearAndCopy(src, dst) {\n */\n angular.module('ngResource', ['ng']).\n provider('$resource', function() {\n+ var PROTOCOL_AND_DOMAIN_REGEX = /^http(?:s)?:\\/\\/[^\\/]*/;\n var provider = this;\n \n this.defaults = {\n\nCodereview: ", "role": "user" }, { "content": "Why not `(?:s)?` --> `s?` ? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -192,7 +192,7 @@ describe('injector', function() {\n \n \n it('should create $inject', function() {\n- var extraParans = angular.noop;\n+ var extraParams = angular.noop;\n /* eslint-disable space-before-function-paren */\n // keep the multi-line to make sure we can handle it\n function $f_n0 /*\n\nCodereview: ", "role": "user" }, { "content": "It took me a long time to try to decide if this should be `extraParams` or `extraParens`, the initial commit was not remotely helpful. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -185,7 +185,7 @@ Blockly.ScratchBlocks.ProcedureUtils.removeAllInputs_ = function() {\n */\n Blockly.ScratchBlocks.ProcedureUtils.createAllInputs_ = function(connectionMap) {\n // Split the proc into components, by %n, %b, and %s (ignoring escaped).\n- var procComponents = this.procCode_.split(/(?=[^\\\\]\\%[nbs])/);\n+ var procComponents = this.procCode_.split(/(?=[^\\\\]%[nbs])/);\n procComponents = procComponents.map(function(c) {\n return c.trim(); // Strip whitespace.\n });\nCodereview: ", "role": "user" } ]
973d5f8f3c42730f
{ "callgraph": "[RefactoringChecker->[_check_superfluous_else_raise->[_check_superfluous_else],process_tokens->[_is_trailing_comma],_check_nested_blocks->[_is_actual_elif],_check_chained_comparison->[_find_lower_upper_bounds],visit_with->[_check_redefined_argument_from_local],_check_consider_merging_isinstance->[_duplicated_isinstance_types],__init__->[__init__],visit_if->[_check_superfluous_else_raise,_check_superfluous_else_return,_check_simplifiable_if,_check_consider_get],_check_swap_variables->[_is_simple_assignment],visit_assign->[_check_swap_variables],_check_superfluous_else->[_is_actual_elif,_if_statement_is_always_returning],visit_excepthandler->[_check_redefined_argument_from_local],leave_module->[_init],visit_augassign->[_check_consider_using_join],visit_for->[_check_redefined_argument_from_local],_is_node_return_ended->[_is_node_return_ended],visit_boolop->[_check_chained_comparison,_check_consider_using_in,_check_consider_merging_isinstance],visit_call->[_check_consider_using_comprehension_constructor],_check_simplifiable_if->[_is_actual_elif,_is_bool_const],_check_superfluous_else_return->[_check_superfluous_else],_check_raising_stopiteration_in_generator_next_call->[_looks_like_infinite_iterator],_check_consider_get->[type_and_name_are_equal]],RecommandationChecker->[visit_for->[_is_constant_zero,_is_builtin]],_is_trailing_comma->[get_curline_index_start],LenChecker->[visit_call->[_is_len_call,_node_is_test_condition],visit_unaryop->[_is_len_call]],register->[RefactoringChecker,RecommandationChecker,NotChecker,LenChecker]]", "msg": "I don't know if there are strict conventions about this, but I think the name of the warning should be the diagnosis, not the suggested course of action. In this case, that would mean changing the name of the warning to `interactive-exit` or something like that.", "patch": "@@ -273,6 +273,11 @@ class RefactoringChecker(checkers.BaseTokenChecker):\n \"consider using the list, dict or set constructor. \"\n \"It is faster and simpler.\",\n ),\n+ \"R1722\": (\n+ \"Consider using sys.exit()\",\n+ \"consider-using-sys-exit\",\n+ \"Instead of using exit() or quit(), consider using the sys.exit().\",\n+ ),\n }\n options = (\n (", "summary": "Uses the dict constructor a list of transient objects and a list of objects that can be used A class that checks a name of functions that never returns." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -149,7 +149,8 @@ def simulate_raw(info, stc=None, trans=None, src=None, bem=None, head_pos=None,\n See Notes for details.\n \n .. versionchanged:: 0.18\n- Support for tuple, and iterable of tuple or SourceEstimate.\n+ Support for tuple, iterable of tuple or SourceEstimate,\n+ or SourceSimulator.\n trans : dict | str | None\n Either a transformation filename (usually made using mne_analyze)\n or an info dict (usually opened using read_trans()).\n\nCodereview: ", "role": "user" }, { "content": "the stc param type description should be changed accordingly. So far it just says: `stc : iterable | SourceEstimate` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -413,6 +413,11 @@ AVAILABLE_CLI_OPTIONS = {\n metavar='INT',\n default=750,\n ),\n+ \"skip_trades\": Arg(\n+ '--skip-trades',\n+ help='Skip using trades file from backtesting and DB.',\n+ action='store_true',\n+ ),\n \"trade_source\": Arg(\n '--trade-source',\n help='Specify the source for trades (Can be DB or file (backtest file)) '\n\nCodereview: ", "role": "user" }, { "content": "Personally, i would prefer to use `--no-trades`. While technically the trades loading is skipped, no-trades seems more intuitive to me - but it's a personal preference - so if you prefer skip-trades that's fine, too </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -921,6 +921,15 @@ def _plugins_parsing(helpful, plugins):\n \"plugins\", \"--configurator\", help=\"Name of the plugin that is \"\n \"both an authenticator and an installer. Should not be used \"\n \"together with --authenticator or --installer.\")\n+ helpful.add(\"plugins\", \"--apache\", action=\"store_true\",\n+ help=\"Obtain and install certs using Apache\")\n+ helpful.add(\"plugins\", \"--nginx\", action=\"store_true\",\n+ help=\"Obtain and install certs using Nginx\")\n+ helpful.add(\"plugins\", \"--standalone\", action=\"store_true\",\n+ help=('Obtain certs using a \"standalone\" webserver. '\n+ 'Changes the default \"run\" command to \"auth\".'))\n+\n+\n \n # things should not be reorder past/pre this comment:\n # plugins_group should be displayed in --help before plugin\n\nCodereview: ", "role": "user" }, { "content": "Help still needs to be updated. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -53,8 +53,8 @@ class KeyClient(AsyncKeyVaultClientBase):\n :param str name: The name of the new key.\n :param key_type: The type of key to create\n :type key_type: ~azure.keyvault.keys.KeyType or str\n- :keyword int size: RSA key size in bits, for example 2048, 3072, or 4096. Applies only to RSA keys. To\n- create an RSA key, consider using :func:`create_rsa_key` instead.\n+ :keyword int size: RSA key size in bits, for example 2048, 3072, or 4096. Applies only to RSA and octet sequence\n+ keys. Consider using :func:`create_rsa_key` or :func:`create_oct_key` instead.\n :keyword curve: Elliptic curve name. Applies only to elliptic curve keys. Defaults to the NIST P-256\n elliptic curve. To create an elliptic curve key, consider using :func:`create_ec_key` instead.\n :paramtype curve: ~azure.keyvault.keys.KeyCurveName or str\n\nCodereview: ", "role": "user" }, { "content": "This is no longer *RSA* key size and if we list example sizes here, we must distinguish between symmetric and RSA key sizes. Also, I lean toward \"symmetric\" over \"octet sequence\" because it's more common. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -273,6 +273,11 @@ AVAILABLE_CLI_OPTIONS = {\n type=check_int_positive,\n metavar='INT',\n ),\n+ \"download_trades\": Arg(\n+ '--dl-trades',\n+ help='Download trades instead of OHLCV data.',\n+ action='store_true',\n+ ),\n \"exchange\": Arg(\n '--exchange',\n help=f'Exchange name (default: `{constants.DEFAULT_EXCHANGE}`). '\n\nCodereview: ", "role": "user" }, { "content": "\"Download trades instead of OHLCV data. The bot will resample trades to the desired timeframe. (target timeframe, goal timeframe, timeframe specified)\" </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -273,6 +273,11 @@ class RefactoringChecker(checkers.BaseTokenChecker):\n \"consider using the list, dict or set constructor. \"\n \"It is faster and simpler.\",\n ),\n+ \"R1722\": (\n+ \"Consider using sys.exit()\",\n+ \"consider-using-sys-exit\",\n+ \"Instead of using exit() or quit(), consider using the sys.exit().\",\n+ ),\n }\n options = (\n (\nCodereview: ", "role": "user" } ]
9ef6bf7111827712
{ "callgraph": "[cleanExpiredHosts->[val,asyncMultiPut,begin,emplace_back,valid,find,size,CHECK_EQ,LOG,end,erase,empty,key,prefix,next],getActiveHosts->[begin,end,size,resize],loadHostMap->[val,valid,LOG,updateHostInfo,key,prefix,next],intervalSeconds_->[CHECK_GT,CHECK_GE,addTimerTask,CHECK,start],updateHostInfo->[wait,asyncMultiPut,emplace_back,find,isLeader,emplace,end,empty,post]]", "msg": "what to do if some failed? just logging?", "patch": "@@ -146,7 +146,9 @@ void ActiveHostsMan::cleanExpiredHosts() {\n LOG(INFO) << \"set \" << data.size() << \" expired hosts to offline in meta rocksdb\";\n kvstore_->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data),\n [] (kvstore::ResultCode code) {\n- CHECK_EQ(code, kvstore::ResultCode::SUCCEEDED);\n+ if (code != kvstore::ResultCode::SUCCEEDED) {\n+ LOG(WARNING) << \"put failed, ret \" << static_cast<int32_t>(code);\n+ }\n });\n }\n }", "summary": "Clean expired hosts. expired hosts to offline in meta rocksdb." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -906,8 +906,8 @@ void attachEvents() {\n for (const auto& subscriber : subscribers) {\n auto status = EventFactory::registerEventSubscriber(subscriber.second);\n if (!status.ok()) {\n- LOG(INFO) << \"Error registering subscriber: \" << subscriber.first << \": \"\n- << status.getMessage();\n+ VLOG(1) << \"Error registering subscriber: \" << subscriber.first << \": \"\n+ << status.getMessage();\n }\n }\n \n\nCodereview: ", "role": "user" }, { "content": "Any particular reason this should stay as an info level log versus something like `LOG(WARNING)`? I think I like the change to `VLOG(1)` also, but it seems to me more consistent with the flow of events if this was a `LOG(WARNING)` as above. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -131,10 +131,9 @@ Status readFile(const fs::path& path,\n auto read_max = static_cast<off_t>(FLAGS_read_max);\n if (file_size > read_max) {\n if (!dry_run) {\n- LOG(WARNING) << \"Cannot read file that exceeds size limit: \"\n- << path.string();\n- VLOG(1) << \"Cannot read \" << path.string()\n- << \" size exceeds limit: \" << file_size << \" > \" << read_max;\n+ return Status::failure(\n+ \"Cannot read \" + path.string() + \" size exceeds limit: \" +\n+ std::to_string(file_size) + \" > \" + std::to_string(read_max));\n }\n return Status::failure(\"File exceeds read limits\");\n }\n\nCodereview: ", "role": "user" }, { "content": "The issue here though is that it's not guaranteed that all the readFile callers will log this error, so we should ensure that they are, to not change the end result. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -62,7 +62,17 @@ void launchQueries(const std::vector<OsqueryScheduledQuery>& queries,\n const int64_t& second) {\n for (const auto& q : queries) {\n if (second % q.interval == 0) {\n- LOG(INFO) << \"Executing query: \" << q.query;\n+ std::string hostIdentifier;\n+ try {\n+ hostIdentifier = getHostIdentifier(FLAGS_host_identifier, DBHandle::getInstance());\n+ }\n+ catch(std::exception& e){\n+ LOG(ERROR) << \"Unable to access hostIdentifier in database: \" << e.what() << \"; Using hostname to \"\n+ \"identify this machine\";\n+ hostIdentifier = osquery::getHostname();\n+ }\n+\n+ LOG(INFO) << hostIdentifier << \" is executing query: \" << q.query;\n int unix_time = std::time(0);\n auto sql = SQL(q.query);\n if (!sql.ok()) {\n\nCodereview: ", "role": "user" }, { "content": "nit, but can you make this `const std::exception& e`? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -623,9 +623,6 @@ Status upgradeDatabase(int to_version) {\n return Status(1, \"Database migration failed.\");\n }\n \n- LOG(INFO) << \"Migration \" << db_version << \" -> \" << (db_version + 1)\n- << \" successfully completed!\";\n-\n db_version++;\n }\n \n\nCodereview: ", "role": "user" }, { "content": "this status is wrong... should be something like 'DB migration ok, failed to set new version' </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -239,6 +239,13 @@ void SchedulerRunner::start() {\n break;\n }\n }\n+\n+ // Scheduler ended.\n+ if (!interrupted()) {\n+ LOG(INFO) << \"The scheduler ended after \" << FLAGS_schedule_timeout\n+ << \" seconds\";\n+ requestShutdown();\n+ }\n }\n \n std::chrono::milliseconds SchedulerRunner::getCurrentTimeDrift() const\n\nCodereview: ", "role": "user" }, { "content": "Why use `FLAGS_schedule_timeout` here? Wouldn't it be better to write out `_timeout` so we know how long it actually ran for, as opposed to the desired timeout? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -146,7 +146,9 @@ void ActiveHostsMan::cleanExpiredHosts() {\n LOG(INFO) << \"set \" << data.size() << \" expired hosts to offline in meta rocksdb\";\n kvstore_->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data),\n [] (kvstore::ResultCode code) {\n- CHECK_EQ(code, kvstore::ResultCode::SUCCEEDED);\n+ if (code != kvstore::ResultCode::SUCCEEDED) {\n+ LOG(WARNING) << \"put failed, ret \" << static_cast<int32_t>(code);\n+ }\n });\n }\n }\nCodereview: ", "role": "user" } ]
227dc48253ec11e5
{ "callgraph": "[Error->[Error],Shutdown->[Wait,add,recoveryHandleCleanup,Close,hasErrors,Errorf,Shutdown,Go,p2pCancel],NewTracer,Start,Sleep,SetAddPeersHandler,Init,Int64,WithConnectionConfigs,Join,NewFixedPricer,SetPaymentThresholdObserver,EthereumAddress,WriterLevel,Background,NewChequeStore,NewStateStore,HexToAddress,NewCashoutService,Debugf,Bytes,SetSwap,SetPushSyncer,Warningf,Addresses,AddProtocol,Register,NewMultiResolver,NewFactory,IsHexAddress,SetNotifyPaymentFunc,Protocol,WithLogger,Metrics,NewRepairHandler,MustRegisterMetrics,After,Ready,Dial,NATManager,Serve,NewService,Debug,New,SetNotifier,DiscoverFactoryAddress,NewAccounting,NewChequeSigner,NewAddressbook,NewTags,Info,Warning,Infof,WithCancel,NewMultiaddr,NewCallback,Addr,Error,ChainID,Errorf,Listen]", "msg": "It provides a type called Node which is a fully functional bee client. This package is where the dependencies are injected. It is not just a glue-code, it is concept of node.", "patch": "@@ -2,6 +2,8 @@\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n \n+// Package node provides the glue-code needed in order\n+// to start a Bee node.\n package node\n \n import (", "summary": "License for the BSD - style license of the source code. Package hierarchy for all packages." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -2,6 +2,10 @@\n // Use of this source code is governed by a MIT-style\n // license that can be found in the LICENSE file.\n \n+// Copyright 2018 The Gitea Authors. All rights reserved.\n+// Use of this source code is governed by a MIT-style\n+// license that can be found in the LICENSE file.\n+\n package repo\n \n import (\n\nCodereview: ", "role": "user" }, { "content": "This is not required </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1,10 +1,12 @@\n // Copyright 2014 The Gogs Authors. All rights reserved.\n+// Copyright 2019 The Gogs Authors. All rights reserved.\n // Use of this source code is governed by a MIT-style\n // license that can be found in the LICENSE file.\n \n package context\n \n import (\n+\t\"code.gitea.io/gitea/models\"\n \t\"code.gitea.io/gitea/modules/auth\"\n \t\"code.gitea.io/gitea/modules/log\"\n \t\"code.gitea.io/gitea/modules/setting\"\n\nCodereview: ", "role": "user" }, { "content": "Gitea, not Gogs. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1,4 +1,5 @@\n // Copyright 2016 The Gogs Authors. All rights reserved.\n+// Copyright 2016 The Gitea Authors. All rights reserved.\n // Use of this source code is governed by a MIT-style\n // license that can be found in the LICENSE file.\n \n\nCodereview: ", "role": "user" }, { "content": "Please send this line top on the Gogs </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1,10 +1,15 @@\n // Copyright 2015 The Gogs Authors. All rights reserved.\n+// Copyright 2019 The Gitea Authors. All rights reserved.\n // Use of this source code is governed by a MIT-style\n // license that can be found in the LICENSE file.\n \n package models\n \n-import \"fmt\"\n+import (\n+\t\"fmt\"\n+\n+\t\"code.gitea.io/gitea/modules/git\"\n+)\n \n // ErrNameReserved represents a \"reserved name\" error.\n type ErrNameReserved struct {\n\nCodereview: ", "role": "user" }, { "content": "This isn't your fault - but this file is insanely long now. It needs splitting - but that can be done in different PR. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1,4 +1,4 @@\n-// Copyright 2014 The Gogs Authors. All rights reserved.\n+// Copyright 2017 Gitea. All rights reserved.\n // Use of this source code is governed by a MIT-style\n // license that can be found in the LICENSE file.\n \n\nCodereview: ", "role": "user" }, { "content": "Hm, you can add a line. But the copyright to the old stuff cannot be removed, FMPOV. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -2,6 +2,8 @@\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n \n+// Package node provides the glue-code needed in order\n+// to start a Bee node.\n package node\n \n import (\nCodereview: ", "role": "user" } ]
24d018dc07d55e7c
{ "callgraph": "[EthGetCode->[getName->[getMethodName],blockParameterOrBlockHash->[getRequiredParameter],resultByBlockHash->[toHexString,isPresent,getPrivateWorldStateAtBlock,getRequiredParameter,orElse,get,getBlockHeaderByHash,getGoQuorumPrivacyParameters]]]", "msg": "Same here, can we presume if `privacyParameters` is set we need goQuorum handling? Or is there a goQuorum sub option in `privacyParametes`?", "patch": "@@ -64,7 +64,8 @@ public class EthGetCode extends AbstractBlockParameterOrBlockHashMethod {\n @Override\n protected String resultByBlockHash(final JsonRpcRequestContext request, final Hash blockHash) {\n final Address address = request.getRequiredParameter(0, Address.class);\n- if (GoQuorumOptions.goQuorumCompatibilityMode && privacyParameters.isPresent()) {\n+ final boolean isGoQuorumCompatibilityMode = GoQuorumOptions.goQuorumCompatibilityMode;\n+ if (isGoQuorumCompatibilityMode && privacyParameters.isPresent()) {\n // get from private state if we can\n final Optional<BlockHeader> blockHeader =\n blockchainQueries.get().getBlockHeaderByHash(blockHash);", "summary": "Get the code associated with a block." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -42,14 +42,14 @@ import org.infinispan.remoting.transport.Address;\n * @author wburns\n * @since 9.3\n */\n-@Listener\n public class DefaultSegmentedDataContainer<K, V> extends AbstractInternalDataContainer<K, V> {\n \n private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());\n private static final boolean trace = log.isTraceEnabled();\n \n- public final AtomicReferenceArray<ConcurrentMap<K, InternalCacheEntry<K, V>>> maps;\n- protected Address localNode;\n+ protected final AtomicReferenceArray<ConcurrentMap<K, InternalCacheEntry<K, V>>> maps;\n+ protected boolean shouldStopSegments;\n+\n \n public DefaultSegmentedDataContainer(int numSegments) {\n maps = new AtomicReferenceArray<>(numSegments);\n\nCodereview: ", "role": "user" }, { "content": "What are we removing this? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -226,10 +226,8 @@ public class DiceServerEditor extends JPanel {\n public boolean areFieldsValid() {\n final boolean toValid =\n !toAddress.getText().isEmpty() && PlayerEmailValidation.isValid(toAddress.getText());\n- SwingComponents.highlightLabelIfNotValid(toValid, toLabel);\n final boolean ccValid =\n !ccAddress.getText().isEmpty() && PlayerEmailValidation.isValid(ccAddress.getText());\n- SwingComponents.highlightLabelIfNotValid(ccValid, ccLabel);\n \n final boolean allValid = toValid && ccValid;\n testDiceButton.setEnabled(allValid);\n\nCodereview: ", "role": "user" }, { "content": "In theory the enabled button stuff should be performed on the event queue as well, but swing doesn't really care. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -71,7 +71,14 @@ public final class OAuth20ProfileController extends AbstractController {\n protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response)\n throws Exception {\n \n- final String accessToken = request.getParameter(OAuthConstants.ACCESS_TOKEN);\n+ String accessToken = request.getParameter(OAuthConstants.ACCESS_TOKEN);\n+ if (StringUtils.isBlank(accessToken)) {\n+ // try getting the bearer token from the authorization header\n+ final String authHeader = request.getHeader(\"Authorization\");\n+ if (authHeader != null && authHeader.startsWith(\"bearer \")) {\n+ accessToken = authHeader.substring(7);\n+ }\n+ }\n LOGGER.debug(\"{} : {}\", OAuthConstants.ACCESS_TOKEN, accessToken);\n \n final JsonGenerator jsonGenerator = this.jsonFactory.createJsonGenerator(response.getWriter());\n\nCodereview: ", "role": "user" }, { "content": "This should also be StringUtils.isNotBlank </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -71,7 +71,13 @@ public final class OAuth20ProfileController extends AbstractController {\n protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response)\n throws Exception {\n \n- final String accessToken = request.getParameter(OAuthConstants.ACCESS_TOKEN);\n+ String accessToken = request.getParameter(OAuthConstants.ACCESS_TOKEN);\n+ if (StringUtils.isBlank(accessToken)) {\n+ final String authHeader = request.getHeader(\"Authorization\");\n+ if (StringUtils.isNotBlank(accessToken) && authHeader.startsWith(\"bearer \")) {\n+ accessToken = authHeader.substring(7);\n+ }\n+ }\n LOGGER.debug(\"{} : {}\", OAuthConstants.ACCESS_TOKEN, accessToken);\n \n final JsonGenerator jsonGenerator = this.jsonFactory.createJsonGenerator(response.getWriter());\n\nCodereview: ", "role": "user" }, { "content": "This String probably should be moved over to `OAuthConstants`? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -161,9 +161,9 @@ public class AsyncQueryForwardingServlet extends AsyncProxyServlet\n final String defaultHost = hostFinder.getDefaultHost();\n request.setAttribute(HOST_ATTRIBUTE, defaultHost);\n \n- final boolean isQueryEndpoint = request.getRequestURI().startsWith(\"/druid/v2\");\n+ final String requestURI = request.getRequestURI();\n \n- if (isQueryEndpoint && HttpMethod.DELETE.is(request.getMethod())) {\n+ if (requestURI.startsWith(QUERY_URL_V2) && HttpMethod.DELETE.is(request.getMethod())) {\n // query cancellation request\n for (final String host : hostFinder.getAllHosts()) {\n // send query cancellation to all brokers this query may have gone to\n\nCodereview: ", "role": "user" }, { "content": "This kind of logic strikes me as something that should be able to be handled at a more abstract routing level. Have you had a chance to look for such items? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -64,7 +64,8 @@ public class EthGetCode extends AbstractBlockParameterOrBlockHashMethod {\n @Override\n protected String resultByBlockHash(final JsonRpcRequestContext request, final Hash blockHash) {\n final Address address = request.getRequiredParameter(0, Address.class);\n- if (GoQuorumOptions.goQuorumCompatibilityMode && privacyParameters.isPresent()) {\n+ final boolean isGoQuorumCompatibilityMode = GoQuorumOptions.goQuorumCompatibilityMode;\n+ if (isGoQuorumCompatibilityMode && privacyParameters.isPresent()) {\n // get from private state if we can\n final Optional<BlockHeader> blockHeader =\n blockchainQueries.get().getBlockHeaderByHash(blockHash);\nCodereview: ", "role": "user" } ]
bdc84bf1acc175a6
{ "callgraph": "[MethodNameDeclaration->[getParameterDisplaySignature->[getParameterCount,isVarargs],isVarargs->[isVarargs],toString->[getParameterCount],equals->[getParameterCount,isVarargs,equals],hashCode->[getParameterCount,hashCode],getParameterCount->[getParameterCount]]]", "msg": "In case the method is `void`, there won't be any children and `getChild(0)` throws. We'll need to check with `isVoid()` for that case. I'll update this when I merge.", "patch": "@@ -32,6 +32,11 @@ public class MethodNameDeclaration extends AbstractNameDeclaration {\n return p.isVarargs();\n }\n \n+ public boolean isPrimitiveReturnType() {\n+ return getMethodNameDeclaratorNode().getParent().getResultType().getChild(0)\n+ .getChild(0) instanceof ASTPrimitiveType;\n+ }\n+\n public ASTMethodDeclarator getMethodNameDeclaratorNode() {\n return (ASTMethodDeclarator) node;\n }", "summary": "This method returns true if the node is a varargs or a formal parameter." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -32,6 +32,11 @@ public class DubboInstrumentationModule extends InstrumentationModule {\n return hasClassesNamed(\"org.apache.dubbo.rpc.Filter\");\n }\n \n+ @Override\n+ public boolean isLibraryInstrumentationClass(String className) {\n+ return className.startsWith(\"io.opentelemetry.instrumentation.apachedubbo.v2_7\");\n+ }\n+\n @Override\n public List<TypeInstrumentation> typeInstrumentations() {\n return Collections.singletonList(new DubboInstrumentation());\n\nCodereview: ", "role": "user" }, { "content": "Can this be replaced with `this.getClass().getPackage().getName()` and moved to superclass? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -2530,6 +2530,17 @@ public class DoFnSignatures {\n return signatureForDoFn(doFn).usesState() || requiresTimeSortedInput(doFn);\n }\n \n+ private static boolean containsBundleFinalizer(List<Parameter> parameters) {\n+ return parameters.stream().anyMatch(parameter -> parameter instanceof BundleFinalizerParameter);\n+ }\n+\n+ public static boolean usesBundleFinalizer(DoFn<?, ?> doFn) {\n+ DoFnSignature sig = signatureForDoFn(doFn);\n+ return containsBundleFinalizer(sig.startBundle().extraParameters())\n+ || containsBundleFinalizer(sig.finishBundle().extraParameters())\n+ || containsBundleFinalizer(sig.processElement().extraParameters());\n+ }\n+\n public static boolean requiresTimeSortedInput(DoFn<?, ?> doFn) {\n return signatureForDoFn(doFn).processElement().requiresTimeSortedInput();\n }\n\nCodereview: ", "role": "user" }, { "content": "Technically, the design of the class is to use `parameter.match(new Cases() { ... })` but I'll accept this. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -31,6 +31,10 @@ public class ActorRestartTest extends BaseTest {\n return value;\n }\n \n+ public boolean askRayWasCurrentActorRestarted() {\n+ return Ray.getRuntimeContext().wasCurrentActorRestarted();\n+ }\n+\n public int getPid() {\n return SystemUtil.pid();\n }\n\nCodereview: ", "role": "user" }, { "content": "what about `checkWasCurrentActorRestartedInActorTask`? and `wasCurrentActorRestarted` can be renamed to `checkWasCurrentActorRestartedInActorCreationTask` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -34,6 +34,16 @@ public class FindInFilesEvent extends GwtEvent<FindInFilesEvent.Handler>\n return searchPattern_;\n }\n \n+ public boolean getReplace()\n+ {\n+ return replace_;\n+ }\n+\n+ public String getReplacePattern()\n+ {\n+ return replacePattern_;\n+ }\n+\n @Override\n public Type<Handler> getAssociatedType()\n {\n\nCodereview: ", "role": "user" }, { "content": "Nit: Could you rename this to something that sounds like a boolean phrase like `isReplace` or `replaceEnabeled`? Right now the name feels to me like it should return a replace string </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -264,4 +264,18 @@ public abstract class ServerNotification extends EventObject implements MuleCont\n return resource;\n }\n \n+ public static boolean resolveEventReference(MuleEvent event)\n+ {\n+ if (event instanceof VoidMuleEvent)\n+ {\n+ return true;\n+ }\n+ \n+ if (event instanceof DefaultMuleEvent)\n+ {\n+ return ((DefaultMuleEvent) event).resolveEventSynchronicity();\n+ }\n+ \n+ return event.isSynchronous();\n+ }\n }\n\nCodereview: ", "role": "user" }, { "content": "only have this check and return true otherwise </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -32,6 +32,11 @@ public class MethodNameDeclaration extends AbstractNameDeclaration {\n return p.isVarargs();\n }\n \n+ public boolean isPrimitiveReturnType() {\n+ return getMethodNameDeclaratorNode().getParent().getResultType().getChild(0)\n+ .getChild(0) instanceof ASTPrimitiveType;\n+ }\n+\n public ASTMethodDeclarator getMethodNameDeclaratorNode() {\n return (ASTMethodDeclarator) node;\n }\nCodereview: ", "role": "user" } ]
428337f896113abb
{ "callgraph": "[RefactoringChecker->[leave_module->[_init],_check_consider_merging_isinstance->[_duplicated_isinstance_types],__init__->[__init__],visit_augassign->[_check_consider_using_join],visit_if->[_check_superfluous_else_return,_check_simplifiable_if,_check_consider_get],_check_swap_variables->[_is_simple_assignment],visit_for->[_check_redefined_argument_from_local],_check_nested_blocks->[_is_actual_elif],_is_node_return_ended->[_is_node_return_ended],_check_consider_get->[type_and_name_are_equal],_check_superfluous_else_return->[_is_actual_elif,_if_statement_is_always_returning],visit_assign->[_check_swap_variables],_check_raising_stopiteration_in_generator_next_call->[_looks_like_infinite_iterator],visit_boolop->[_check_consider_using_in,_check_consider_merging_isinstance],visit_with->[_check_redefined_argument_from_local],_check_simplifiable_if->[_is_actual_elif,_is_bool_const],visit_excepthandler->[_check_redefined_argument_from_local]],_if_statement_is_always_returning->[_has_return_node->[_if_statement_is_always_returning],_has_return_node,_all_elements_are_true],RecommandationChecker->[visit_for->[_is_builtin]],is_trailing_comma->[get_curline_index_start],LenChecker->[visit_compare->[_is_len_call,_is_constant_zero,_has_constant_value,_node_is_test_condition],visit_call->[_is_len_call,_node_is_test_condition],visit_unaryop->[_is_len_call]],register->[RefactoringChecker,RecommandationChecker,NotChecker,LenChecker]]", "msg": "I'd rephrase it as `Simplify chained comparison between the operands`.", "patch": "@@ -155,6 +155,10 @@ class RefactoringChecker(checkers.BaseTokenChecker):\n 'if a key is present or a default if not, is simpler and considered '\n 'more idiomatic, although sometimes a bit slower'\n ),\n+ 'R1716': ('simplify chained comparison',\n+ 'chained-comparison',\n+ 'Chained comparisons like \"a < b and b < c\" can be simplified as \"a < b < c\"',\n+ ),\n }\n options = (('max-nested-blocks',\n {'default': 5, 'type': 'int', 'metavar': '<int>',", "summary": "Requirements for the n - nested - block function. Constructor for a TokenChecker class." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -81,10 +81,11 @@ class RequirementSet(object):\n wheel.filename\n )\n \n- install_req.use_user_site = self.use_user_site\n- install_req.target_dir = self.target_dir\n- install_req.pycompile = self.pycompile\n- install_req.is_direct = (parent_req_name is None)\n+ # This next bit is really a sanity check.\n+ assert install_req.is_direct == (parent_req_name is None), (\n+ \"a direct req shouldn't have a parent and also, \"\n+ \"a non direct req should have a parent\"\n+ )\n \n if not name:\n # url or path requirement w/o an egg fragment\n\nCodereview: ", "role": "user" }, { "content": "@pfmoore the intention is to have requirementset.add do less. By moving this outside, I've tried to make it explicit which paths go which way. This makes it easier to keep track of what's happening (because this bit of code is highly intertwined). I'm sort of trying to untangle this bit of code here. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -81,10 +81,11 @@ class RequirementSet(object):\n wheel.filename\n )\n \n- install_req.use_user_site = self.use_user_site\n- install_req.target_dir = self.target_dir\n- install_req.pycompile = self.pycompile\n- install_req.is_direct = (parent_req_name is None)\n+ # This next bit is really a sanity check.\n+ assert install_req.is_direct == (parent_req_name is None), (\n+ \"a direct req shouldn't have a parent and also, \"\n+ \"a non direct req should have a parent\"\n+ )\n \n if not name:\n # url or path requirement w/o an egg fragment\n\nCodereview: ", "role": "user" }, { "content": "@pfmoore the intention is to have requirementset.add do less. By moving this outside, I've tried to make it explicit which paths go which way. This makes it easier to keep track of what's happening (because this bit of code is highly intertwined). I'm sort of trying to untangle this bit of code here. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -97,9 +97,9 @@ def test_state_operators():\n \n \n def test_event_operators():\n- a = EventTransferSentSuccess(2)\n- b = EventTransferSentSuccess(2)\n- c = EventTransferSentSuccess(3)\n+ a = EventTransferSentSuccess(2, 5, sha3('target'))\n+ b = EventTransferSentSuccess(2, 5, sha3('target'))\n+ c = EventTransferSentSuccess(3, 4, sha3('target'))\n \n assert a == b\n assert not a != b\n\nCodereview: ", "role": "user" }, { "content": "could you add a `d = EventTransferSentSuccess(3, 4, sha3('differenttarget'))` and assert on it being non-equal to `c`? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -43,6 +43,13 @@ namespace Content.Server.GameObjects.Components.Metabolism\n serializer.DataField(this, b => b.NeedsGases, \"needsGases\", new Dictionary<Gas, float>());\n serializer.DataField(this, b => b.ProducesGases, \"producesGases\", new Dictionary<Gas, float>());\n serializer.DataField(this, b => b.DeficitGases, \"deficitGases\", new Dictionary<Gas, float>());\n+ serializer.DataField(this, b => b.MetabolismHeat, \"metabolismHeat\", 0);\n+ serializer.DataField(this, b => b.RadiatedHeat, \"radiatedHeat\", 0);\n+ serializer.DataField(this, b => b.SweatHeatRegulation, \"sweatHeatRegulation\", 0);\n+ serializer.DataField(this, b => b.ShiveringHeatRegulation, \"shiveringHeatRegulation\", 0);\n+ serializer.DataField(this, b => b.ImplicitHeatRegulation, \"implicitHeatRegulation\", 0);\n+ serializer.DataField(this, b => b.NormalBodyTemperature, \"normalBodyTemperature\", 0);\n+ serializer.DataField(this, b => b.ThermalRegulationTemperatureThreshold, \"thermalRegulationTemperatureThreshold\", 0);\n serializer.DataField(ref _suffocationDamage, \"suffocationDamage\", 1);\n }\n \n\nCodereview: ", "role": "user" }, { "content": "Maybe you should give those default values some sane numbers other than 0, just in case someone forgets to set them </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -120,8 +120,8 @@ public class DefaultCompositeByteBuf extends AbstractByteBuf implements Composit\n final int capacity = components.get(numComponents - 1).endOffset + readableBytes;\n \n ByteBuf consolidated = buffer.unsafe().newBuffer(capacity);\n- for (int i = 0; i < numComponents; i ++) {\n- ByteBuf b = components.get(i).buf;\n+ for (Component component : components) {\n+ ByteBuf b = component.buf;\n consolidated.writeBytes(b);\n b.unsafe().release();\n }\n\nCodereview: ", "role": "user" }, { "content": "Wouldn't this create a new iterator which adds some GC pressure? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -155,6 +155,10 @@ class RefactoringChecker(checkers.BaseTokenChecker):\n 'if a key is present or a default if not, is simpler and considered '\n 'more idiomatic, although sometimes a bit slower'\n ),\n+ 'R1716': ('simplify chained comparison',\n+ 'chained-comparison',\n+ 'Chained comparisons like \"a < b and b < c\" can be simplified as \"a < b < c\"',\n+ ),\n }\n options = (('max-nested-blocks',\n {'default': 5, 'type': 'int', 'metavar': '<int>',\nCodereview: ", "role": "user" } ]
03d2d664448693b3
{ "callgraph": "[No CFG could be retrieved]", "msg": "can you replace the tabs with 2 spaces please to match the rest of the project?", "patch": "@@ -14,3 +14,17 @@ function roots_get_search_form($form) {\n return $form;\n }\n add_filter('get_search_form', 'roots_get_search_form');\n+\n+/**\n+ * Add page slug to body_class() classes if it doesn't exist\n+ */\n+function roots_body_class($classes) {\n+ // Add post/page slug\n+ if (is_single() || is_page() && !is_front_page()) {\n+ \tif (!in_array(basename(get_permalink()), $classes)) {\n+ \t\t$classes[] = basename(get_permalink());\n+ \t}\n+ }\n+ return $classes;\n+}\n+add_filter('body_class', 'roots_body_class');", "summary": "Get search form from roots." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -14,3 +14,17 @@ export function useResourcesNotify() {\n }\n });\n }\n+\n+/**\n+ * Combines multiple refs to pass into `ref` prop.\n+ * @param {...any} refs\n+ * @return {function(!Element)}\n+ */\n+export function refs(...refs) {\n+ return (element) => {\n+ for (let i = 0; i < refs.length; i++) {\n+ const ref = refs[i];\n+ typeof ref == 'function' ? ref(element) : (ref.current = element);\n+ }\n+ };\n+}\n\nCodereview: ", "role": "user" }, { "content": "Use `useCallback` to avoid trashing the ref. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -804,9 +804,10 @@ export class NextPageService {\n * Add the provided page metadata into the queue of\n * pages to fetch\n * @param {!Array<!./page.PageMeta>} pages\n+ * @param {boolean} preventFetching\n * @return {!Promise}\n */\n- queuePages_(pages) {\n+ queuePages_(pages, preventFetching = false) {\n if (!pages.length || this.finished_) {\n return Promise.resolve();\n }\n\nCodereview: ", "role": "user" }, { "content": "Instead of using a boolean parameter, can we rename this method `fetchAndQueuePages` which calls a more concise version of `queuePages_` that we can use above? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -422,6 +422,17 @@ function triggerRenderStart(opt_data) {\n */\n function observeIntersection(observerCallback) {\n // Send request to received records.\n+ if (window.IntersectionObserver && window.IntersectionObserver.prototype) {\n+ // use native IntersectionObserver if exist\n+ const io = new window.IntersectionObserver(changes => {\n+ observerCallback(changes);\n+ }, {\n+ threshold: DEFAULT_THRESHOLD,\n+ });\n+ io.observe(window.document.documentElement);\n+ const unlistener = () => io.unobserve(window.document.documentElement);\n+ return unlistener;\n+ }\n nonSensitiveDataPostMessage('send-intersections');\n return listenParent(window, 'intersection', data => {\n observerCallback(data.changes);\n\nCodereview: ", "role": "user" }, { "content": "return in the above line? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -318,7 +318,16 @@ export function getParentWindow(win) {\n * @return {!Window}\n */\n export function getTopWindow(win) {\n- return win.__AMP_TOP || win;\n+ const top = win.__AMP_TOP;\n+ if (top === null) {\n+ return win;\n+ }\n+ if (top != null) {\n+ return top;\n+ }\n+ // Make this defined but null to speed up future lookups.\n+ win.__AMP_TOP = null;\n+ return win;\n }\n \n /**\n\nCodereview: ", "role": "user" }, { "content": "We could set this to `win` instead? Then keep the same `||`: `win.__AMP_TOP || (win.__AMP_TOP = win)` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -318,8 +318,14 @@ const addReturnValueToEvent = (event) => {\n })\n }\n \n+let warnedAboutRendererProcessReuse = false\n+\n // Add JavaScript wrappers for WebContents class.\n WebContents.prototype._init = function () {\n+ if (!warnedAboutRendererProcessReuse && app._allowRendererProcessReuseIsDefaultValue) {\n+ deprecate.log('The default value of app.allowRendererProcessReuse is deprecated, it is currently \"false\". It will change to be \"true\" in Electron 9. For more information please check https://github.com/electron/electron/issues/18397')\n+ warnedAboutRendererProcessReuse = true\n+ }\n // The navigation controller.\n NavigationController.call(this, this)\n \n\nCodereview: ", "role": "user" }, { "content": "want to use `deprecate.warnOnce` or similar? that pays attention to `process.noDeprecation` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -14,3 +14,17 @@ function roots_get_search_form($form) {\n return $form;\n }\n add_filter('get_search_form', 'roots_get_search_form');\n+\n+/**\n+ * Add page slug to body_class() classes if it doesn't exist\n+ */\n+function roots_body_class($classes) {\n+ // Add post/page slug\n+ if (is_single() || is_page() && !is_front_page()) {\n+ \tif (!in_array(basename(get_permalink()), $classes)) {\n+ \t\t$classes[] = basename(get_permalink());\n+ \t}\n+ }\n+ return $classes;\n+}\n+add_filter('body_class', 'roots_body_class');\nCodereview: ", "role": "user" } ]
567e3ca0398070bd
{ "callgraph": "[No CFG could be retrieved]", "msg": "Please explain why a user would enable this (space savings), and the requirements for this option to be safe.", "patch": "@@ -67,6 +67,10 @@ type Config struct {\n \t// If not set, it uses all versions available.\n \t// Warning: This API should not be considered stable and will change soon.\n \tVersions []protocol.VersionNumber\n+\t// Ask the server to truncate the connection ID sent in the Public Header.\n+\t// This saves 8 bytes in the Public Header in every packet. However, if the IP address of the server changes, the connection cannot be migrated.\n+\t// Currently only valid for the client.\n+\tRequestConnectionIDTruncation bool\n }\n \n // A Listener for incoming QUIC connections", "summary": " type is the constructor for a single config field." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -346,6 +346,10 @@ type ServiceAccountConfig struct {\n \t// Each key is tried in order until the list is exhausted or verification succeeds.\n \t// If no keys are specified, no service account authentication will be available.\n \tPublicKeyFiles []string\n+\n+\t// MasterCA is the CA for verifying the TLS connection back to the master. The service account controller will automatically\n+\t// inject the contents of this file into pods so they can verify connections to the master.\n+\tMasterCA string\n }\n \n type TokenConfig struct {\n\nCodereview: ", "role": "user" }, { "content": "I just realized that the OAuth config also needs this (and is currently incorrectly using servingInfo.clientCA instead - see `GetAPIServerCertCAPool`)... do we want this field replicated in several places, or a single top-level field? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -38,6 +38,12 @@ type Config struct {\n \t// step if not specified.\n \tDefaultEvaluationInterval time.Duration\n \n+\t// Directory for ActiveQueryTracker. If empty, ActiveQueryTracker will be disabled and MaxConcurrent will not be applied (!).\n+\t// ActiveQueryTracker logs queries that were active during the last crash, but logs them on the next startup.\n+\t// However, we need to use active query tracker, otherwise we cannot limit Max Concurrent queries in the PromQL\n+\t// engine.\n+\tActiveQueryTrackerDir string `yaml:\"active_query_tracking_dir\"`\n+\n \t// For testing, to prevent re-registration of metrics in the promql engine.\n \tmetricsRegisterer prometheus.Registerer `yaml:\"-\"`\n }\n\nCodereview: ", "role": "user" }, { "content": "`active_query_tracking_dir` > `active_query_tracker_dir` to be consistent with the CLI flag. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -234,6 +234,9 @@ type SecureServingInfo struct {\n \t// HTTP2MaxStreamsPerConnection is the limit that the api server imposes on each client.\n \t// A value of zero means to use the default provided by golang's HTTP/2 support.\n \tHTTP2MaxStreamsPerConnection int\n+\n+\t// HTTP1Only indicates that http2 should not be enabled.\n+\tHTTP1Only bool\n }\n \n type AuthenticationInfo struct {\n\nCodereview: ", "role": "user" }, { "content": "phrased negatively so the default `false` works. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -187,6 +187,9 @@ type TestParameters struct {\n \t// set to true to use production run mode in tests\n \tUseProductionRunMode bool\n \n+\t// Set to override the Keybase API server URI in a test.\n+\tServerURI string\n+\n \t// whether LogoutIfRevoked check should be skipped to avoid races\n \t// during resets.\n \tSkipLogoutIfRevokedCheck bool\n\nCodereview: ", "role": "user" }, { "content": "do you need this or is it sufficient to just set the URI via env? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -294,6 +294,16 @@ type MasterConfig struct {\n \t// JenkinsPipelineConfig holds information about the default Jenkins template\n \t// used for JenkinsPipeline build strategy.\n \tJenkinsPipelineConfig JenkinsPipelineConfig\n+\n+\t// AuditConfig holds information related to auditing capabilities.\n+\tAuditConfig AuditConfig\n+}\n+\n+// AuditConfig holds configuration for the audit capabilities\n+type AuditConfig struct {\n+\t// If this flag is set, audit log will be printed in the logs.\n+\t// The logs contains, method, user and a requested URL.\n+\tEnabled bool\n }\n \n // JenkinsPipelineConfig holds configuration for the Jenkins pipeline strategy\n\nCodereview: ", "role": "user" }, { "content": "Let's just call this `Enabled`. In the future we can add handler configs for the destinations (basic, files, events, etc) and keep this master flag for the on/off. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -67,6 +67,10 @@ type Config struct {\n \t// If not set, it uses all versions available.\n \t// Warning: This API should not be considered stable and will change soon.\n \tVersions []protocol.VersionNumber\n+\t// Ask the server to truncate the connection ID sent in the Public Header.\n+\t// This saves 8 bytes in the Public Header in every packet. However, if the IP address of the server changes, the connection cannot be migrated.\n+\t// Currently only valid for the client.\n+\tRequestConnectionIDTruncation bool\n }\n \n // A Listener for incoming QUIC connections\nCodereview: ", "role": "user" } ]
816a4a84590c61b2
{ "callgraph": "[testCanClickOnALinkThatOverflowsAndFollowIt->[title_is,WebDriverWait,find_element],loadPage->[load],testClickingALinkMadeUpOfNumbersIsHandledCorrectly->[title_is,WebDriverWait,find_element],fixture]", "msg": "I believe it's misleading name for the condition. I prefer \"element_to_be_disable\" We can have a condition, when element is enabled but we can't click it, because another element overlays above it. So, If we use \"unclickable\" we might mislead people, who use that condition to verify if element can be clicked", "patch": "@@ -35,3 +35,6 @@ def testCanClickOnALinkThatOverflowsAndFollowIt(driver):\n def testClickingALinkMadeUpOfNumbersIsHandledCorrectly(driver):\n driver.find_element(By.LINK_TEXT, \"333333\").click()\n WebDriverWait(driver, 3).until(EC.title_is(\"XHTML Test Page\"))\n+\n+def testCannotClickDisabledButton(driver):\n+ WebDriverWait(driver, 3).until(EC.element_to_be_unclickable(By.ID, \"disabled-button\"))", "summary": "Clicks a link with a text that is a link that is made up of numbers and." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -241,6 +241,17 @@ def wait_until_render_complete(driver):\n from selenium.webdriver.support.ui import WebDriverWait\n from selenium.common.exceptions import TimeoutException\n \n+ def is_bokeh_loaded(driver):\n+ return driver.execute_script('''\n+ const b = window.Bokeh;\n+ return b && b.documents && b.documents.length > 0;\n+ ''')\n+\n+ try:\n+ WebDriverWait(driver, 5, poll_frequency=0.1).until(is_bokeh_loaded)\n+ except TimeoutException as e:\n+ raise_from(RuntimeError('Bokeh was not loaded in time. Something may have gone wrong.'), e)\n+\n driver.execute_script(_WAIT_SCRIPT)\n \n def is_bokeh_render_complete(driver):\n\nCodereview: ", "role": "user" }, { "content": "Should this be in a `try/except` block, that converts the timeout exception into a `RuntimeError` with a more Bokeh-specific message? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -35,7 +35,6 @@ def AssembleTestSuites():\n smallSuite.addTests(KratosUnittest.TestLoader().loadTestsFromTestCases([test_trilinos_linear_solvers.TestLinearSolvers]))\n smallSuite.addTests(KratosUnittest.TestLoader().loadTestsFromTestCases([test_trilinos_matrix.TestTrilinosMatrix]))\n smallSuite.addTests(KratosUnittest.TestLoader().loadTestsFromTestCases([test_trilinos_redistance.TestTrilinosRedistance]))\n- smallSuite.addTests(KratosUnittest.TestLoader().loadTestsFromTestCases([test_trilinos_redistance.TestTrilinosRedistanceInMemory]))\n smallSuite.addTests(KratosUnittest.TestLoader().loadTestsFromTestCases([test_trilinos_levelset_convection.TestTrilinosLevelSetConvection]))\n smallSuite.addTests(KratosUnittest.TestLoader().loadTestsFromTestCases([test_trilinos_levelset_convection.TestTrilinosLevelSetConvectionInMemory]))\n \n\nCodereview: ", "role": "user" }, { "content": "why do you remove this test? IIRC this was intended to check the partitioner however I agree that this is not the place to put such a test :D Seeing that you changed the test to use the in memory partitioner I am ok with it (also a student of mine is currently writing some tests for the partitioner itself :) ) FYI @roigcarlo </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -35,7 +35,6 @@ module Telephony\n \n private\n \n- # rubocop:disable all\n def adapter\n case [Telephony.config.adapter, channel.to_sym]\n when [:pinpoint, :sms]\n\nCodereview: ", "role": "user" }, { "content": "There's a matching `# rubocop:enable all` below. Should it be removed? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -35,7 +35,6 @@ module Telephony\n \n private\n \n- # rubocop:disable all\n def adapter\n case [Telephony.config.adapter, channel.to_sym]\n when [:pinpoint, :sms]\n\nCodereview: ", "role": "user" }, { "content": "There's a matching `# rubocop:enable all` below. Should it be removed? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -35,9 +35,6 @@ files = [\n \n \n class FineGrainedSuite(DataSuite):\n- def __init__(self, *, update_data: bool) -> None:\n- pass\n-\n @classmethod\n def cases(cls) -> List[DataDrivenTestCase]:\n c = [] # type: List[DataDrivenTestCase]\n\nCodereview: ", "role": "user" }, { "content": "Or did you want here a call to `super().__init__`? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -35,3 +35,6 @@ def testCanClickOnALinkThatOverflowsAndFollowIt(driver):\n def testClickingALinkMadeUpOfNumbersIsHandledCorrectly(driver):\n driver.find_element(By.LINK_TEXT, \"333333\").click()\n WebDriverWait(driver, 3).until(EC.title_is(\"XHTML Test Page\"))\n+\n+def testCannotClickDisabledButton(driver):\n+ WebDriverWait(driver, 3).until(EC.element_to_be_unclickable(By.ID, \"disabled-button\"))\nCodereview: ", "role": "user" } ]
4757eb9940585aa7
{ "callgraph": "[PathTemplateCheckView->[newBuilder->[Builder]]]", "msg": "Should this be called something that indicates its function, rather than its content? validationMessagePrefix, or similar?", "patch": "@@ -23,6 +23,8 @@ public abstract class PathTemplateCheckView {\n \n public abstract String paramName();\n \n+ public abstract String methodName();\n+\n public static Builder newBuilder() {\n return new AutoValue_PathTemplateCheckView.Builder();\n }", "summary": "Creates a builder for a path template check view." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -81,6 +81,15 @@ public abstract class DataAdapterDto {\n @JsonProperty(FIELD_NAME)\n public abstract Builder name(String name);\n \n+ @JsonProperty(FIELD_CUSTOM_ERROR_TTL_ENABLED)\n+ public abstract Builder customErrorTTLEnabled(@Nullable Boolean enabled);\n+\n+ @JsonProperty(FIELD_CUSTOM_ERROR_TTL)\n+ public abstract Builder customErrorTTL(@Nullable Long ttl);\n+\n+ @JsonProperty(FIELD_CUSTOM_ERROR_TTL_UNIT)\n+ public abstract Builder customErrorTTLUnit(@Nullable TimeUnit unit);\n+\n @JsonProperty(\"content_pack\")\n public abstract Builder contentPack(@Nullable String contentPack);\n \n\nCodereview: ", "role": "user" }, { "content": "I just thought if we actually need the `custom_error_ttl_enabled` option. Couldn't we just have `error_ttl` and `error_ttl_unit` set those to the default of 5 seconds? That way we would not need a \"custom\" TTL option (no checkbox in the UI), no logic in the `LookupDataAdapter` class contructors to check if the custom TTL is actually enabled and also no hardcoded constant with the default TTL. We cannot use the constant default error result but I guess that's okay because we can build the error result during data adapter construction based on the configuration and reuse that for the lifetime of the data adapter. What do you think? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -144,7 +144,7 @@ public abstract class CommandInterpreter extends Builder {\n return dir.createTextTempFile(\"hudson\", getFileExtension(), getContents(), false);\n }\n \n- public abstract String[] buildCommandLine(FilePath script);\n+ public abstract String[] buildCommandLine(FilePath script, FilePath ws);\n \n protected abstract String getContents();\n \n\nCodereview: ", "role": "user" }, { "content": "You cannot compatibly change the signature of an existing API method. You would have to introduce a new overload which called the existing method by default, and which `BatchFile` would override. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -32,6 +32,8 @@ public abstract class AuthenticationDetails {\n return Builder.create();\n }\n \n+ public abstract AuthenticationDetails.Builder toBuilder();\n+\n @AutoValue.Builder\n public abstract static class Builder {\n \n\nCodereview: ", "role": "user" }, { "content": "It's nice to have this, but we don't have code calling this. If we decide to keep the PR for the UI changes, we should leave this change in. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -22,6 +22,8 @@ import com.google.auto.value.AutoValue;\n public abstract class LDAPUser {\n public abstract String base64UniqueId();\n \n+ public abstract ADUserAccountControl userAccountControl();\n+\n public abstract String username();\n \n public abstract String fullName();\n\nCodereview: ", "role": "user" }, { "content": "I don't think we should put AD specific code into the `LDAPEntry` and `LDAPUser` objects. How about using the `AccountStatus` instead? That makes it independent from AD. We could extract the `AccountStatus` into a separate enum out of the `User` interface to make it a bit more generic. What do you think? I also think we should only have an `accountStatus()` method in `LDAPUser` instead of also putting it into the `LDAPEntry` object. The `LDAPEntry` object is supposed to be generic. We can move the `userAccountControl` parsing into the `createLDAPUser()` method in `UnboundLDAPConnector`. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -298,6 +298,11 @@ public abstract class SqlTransform extends PTransform<PInput, PCollection<Row>>\n return toBuilder().setUdafDefinitions(newUdafs).build();\n }\n \n+ public SqlTransform withErrorsTransformer(\n+ PTransform<PCollection<BeamCalcRelError>, POutput> errorsTransformer) {\n+ return toBuilder().setErrorsTransformer(errorsTransformer).build();\n+ }\n+\n abstract Builder toBuilder();\n \n static Builder builder() {\n\nCodereview: ", "role": "user" }, { "content": "Can you make this `PTransform<PCollection<BeamCalcRelError>, ? extends POutput>` instead? (Or really `PTransform<PCollection<Row>, ? extends POutput>`) </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -23,6 +23,8 @@ public abstract class PathTemplateCheckView {\n \n public abstract String paramName();\n \n+ public abstract String methodName();\n+\n public static Builder newBuilder() {\n return new AutoValue_PathTemplateCheckView.Builder();\n }\nCodereview: ", "role": "user" } ]
de9b46b4341d6597
{ "callgraph": "[remove_pe_defaults_on->[remove_platform_pe_defaults],add_pe_defaults_on->[add_platform_pe_defaults]]", "msg": "This winds up flipping the desired values. Looks like I gave you a bum steer @kevpl", "patch": "@@ -32,7 +32,7 @@ module Beaker\n 'puppetbin' => '/opt/puppet/bin/puppet',\n 'puppetbindir' => '/opt/puppet/bin',\n 'puppetsbindir' => '/opt/puppet/sbin',\n- 'privatebindir' => '/opt/puppetlabs/puppet/bin',\n+ 'privatebindir' => '/opt/puppet/bin',\n 'puppetvardir' => '/var/opt/lib/pe-puppet',\n 'hieradatadir' => '/var/lib/hiera',\n 'hieraconf' => '/etc/puppetlabs/puppet/hiera.yaml',", "summary": "The puppet - labs directory is the root of the system. windows windows puppet service." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -43,6 +43,7 @@ module AlaveteliConfiguration\n :INCOMING_EMAIL_PREFIX => '',\n :INCOMING_EMAIL_SECRET => 'dummysecret',\n :ISO_COUNTRY_CODE => 'GB',\n+ :MINIMUM_REQUESTS_FOR_STATISTICS => 100,\n :MAX_REQUESTS_PER_USER_PER_DAY => '',\n :MTA_LOG_TYPE => 'exim',\n :NEW_RESPONSE_REMINDER_AFTER_DAYS => [3, 10, 24],\n\nCodereview: ", "role": "user" }, { "content": "This should be added to conf/general.yml-example too. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -322,6 +322,7 @@ module Engine\n '105' => 'city=revenue:40,slots:3;path=a:0,b:_0,track:dual;path=a:1,b:_0,track:dual;path=a:2,b:_0,track:dual;label=BM',\n '106' => 'junction;path=a:0,b:_0,track:dual;path=a:2,b:_0,track:dual;path=a:4,b:_0,track:dual;path=a:3,b:_0,track:dual',\n '107' => 'junction;path=a:0,b:_0,track:dual;path=a:1,b:_0,track:dual;path=a:3,b:_0,track:dual;path=a:4,b:_0,track:dual',\n+ '108' => 'junction;path=a:0,b:_0,track:dual;path=a:1,b:_0,track:dual;path=a:2,b:_0,track:dual;path=a:3,b:_0,track:dual',\n '118' => 'city=revenue:40;city=revenue:40;path=a:0,b:_0;path=a:_0,b:1;path=a:2,b:_1;path=a:_1,b:3',\n '122' => 'city=revenue:80,slots:2;city=revenue:80,slots:2;path=a:0,b:_0;path=a:_0,b:1;path=a:2,b:_1;path=a:_1,b:3;label=T',\n '125' => 'city=revenue:40,slots:2;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0',\n\nCodereview: ", "role": "user" }, { "content": "This should be in the game config. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -30,6 +30,7 @@ module Engine\n '56' => 'town=revenue:10;town=revenue:10;path=a:0,b:_0;path=a:_0,b:2;path=a:1,b:_1;path=a:_1,b:3',\n '57' => 'city=revenue:20;path=a:0,b:_0;path=a:_0,b:3',\n '58' => 'town=revenue:10;path=a:0,b:_0;path=a:_0,b:2',\n+ '59s' => 'city=revenue:20;path=a:0,b:_0',\n '69' => 'town=revenue:10;town=revenue:10;path=a:0,b:_0;path=a:_0,b:3;path=a:2,b:_1;path=a:_1,b:4',\n # '71' => 'town=revenue:10;town=revenue:10;path=a:0,b:_0,track:narrow;path=a:_0,b:2,track:narrow',\n '72' => 'town=revenue:10;path=a:0,b:_0,track:narrow;path=a:_0,b:1,track:narrow',\n\nCodereview: ", "role": "user" }, { "content": "Game-specific tiles should not be put into this file. They should go into game/g_1829/map.rb </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -29,7 +29,9 @@ module Search\n },\n \"title\" => hit[\"name\"],\n \"path\" => hit[\"path\"],\n- \"id\" => hit[\"id\"]\n+ \"id\" => hit[\"id\"],\n+ \"class_name\" => \"User\",\n+ \"positive_reactions_count\" => hit[\"positive_reactions_count\"]\n }\n end\n \n\nCodereview: ", "role": "user" }, { "content": "Couple more fields need to render users into the articleHTML template in the main feed. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -53,7 +53,8 @@ module Dependabot\n \"requirements\" => requirements,\n \"previous_version\" => previous_version,\n \"previous_requirements\" => previous_requirements,\n- \"package_manager\" => package_manager\n+ \"package_manager\" => package_manager,\n+ \"metadata\" => metadata\n }\n end\n \n\nCodereview: ", "role": "user" }, { "content": "Might want to call `compact` here, so that setups without metadata don't include that key. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -32,7 +32,7 @@ module Beaker\n 'puppetbin' => '/opt/puppet/bin/puppet',\n 'puppetbindir' => '/opt/puppet/bin',\n 'puppetsbindir' => '/opt/puppet/sbin',\n- 'privatebindir' => '/opt/puppetlabs/puppet/bin',\n+ 'privatebindir' => '/opt/puppet/bin',\n 'puppetvardir' => '/var/opt/lib/pe-puppet',\n 'hieradatadir' => '/var/lib/hiera',\n 'hieraconf' => '/etc/puppetlabs/puppet/hiera.yaml',\nCodereview: ", "role": "user" } ]
c2e04cd8e85c8f1f
{ "callgraph": "[Const->[REGISTRY_API->[getRegistryApiVersion,format,equals,getDomainName]]]", "msg": "are you sure you can read version by this artifactid?", "patch": "@@ -148,6 +148,10 @@ public final class Const {\n public static final String PATH_CHECKSESSION = \"checksession\";\n \n public static final String URL_PREFIX = \"urlPrefix\";\n- \n+\n public static final String INSTANCE_PUBKEY_PRO = \"publickey\";\n+\n+ public static final String GROUPID = \"io.servicecomb\";\n+\n+ public static final String ARTIFACTID = \"java-chassis\";\n }", "summary": "Get the path checksession and urlPrefix." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -75,12 +75,17 @@ public class HiveOrcSerDeManager extends HiveSerDeManager {\n public static final String DEFAULT_SERDE_TYPE = \"ORC\";\n public static final String INPUT_FORMAT_CLASS_KEY = \"hiveOrcSerdeManager.inputFormatClass\";\n public static final String DEFAULT_INPUT_FORMAT_CLASS = OrcInputFormat.class.getName();\n+ public static final String WRITER_LATEST_SCHEMA = \"writer.latest.schema\";\n \n public static final String OUTPUT_FORMAT_CLASS_KEY = \"hiveOrcSerdeManager.outputFormatClass\";\n public static final String DEFAULT_OUTPUT_FORMAT_CLASS = OrcOutputFormat.class.getName();\n \n public static final String HIVE_SPEC_SCHEMA_READING_TIMER = \"hiveOrcSerdeManager.schemaReadTimer\";\n \n+ public static final String HIVE_SPEC_SCHEMA_FROM_WRITER = \"hiveOrcSerdeManager.getSchemaFromWriterSchema\";\n+ public static final boolean DEFAULT_HIVE_SPEC_SCHEMA_FROM_WRITER = false;\n+\n+\n public static final String ENABLED_ORC_TYPE_CHECK = \"hiveOrcSerdeManager.enableFormatCheck\";\n public static final boolean DEFAULT_ENABLED_ORC_TYPE_CHECK = false;\n \n\nCodereview: ", "role": "user" }, { "content": "Do we need to introduce a config? Can we always look for writer schema first and then default to file schema if it doesn't exist? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -147,7 +147,17 @@ public class ConfigurationKeys {\n public static final String EXTRACT_PRIMARY_KEY_FIELDS_KEY = \"extract.primary.key.fields\";\n public static final String EXTRACT_DELTA_FIELDS_KEY = \"extract.delta.fields\";\n public static final String EXTRACT_SCHEMA = \"extract.schema\";\n- public static final String EXTRACT_PULL_LIMIT = \"extract.pull.limit\";\n+ public static final String EXTRACT_LIMIT_ENABLED_KEY = \"extract.limit.enabled\";\n+ public static final boolean DEFAULT_EXTRACT_LIMIT_ENABLED = false;\n+ public static final String EXTRACT_LIMIT_TYPE_KEY = \"extract.limit.type\";\n+ public static final String EXTRACT_LIMIT_RATE_LIMIT_KEY = \"extract.limit.rate.limit\";\n+ public static final String EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY = \"extract.limit.rate.limit.timeunit\";\n+ public static final String DEFAULT_EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT = TimeUnit.SECONDS.toString();\n+ public static final String EXTRACT_LIMIT_TIME_LIMIT_KEY = \"extract.limit.time.limit\";\n+ public static final String EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY = \"extract.limit.time.limit.timeunit\";\n+ public static final String DEFAULT_EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT = TimeUnit.SECONDS.toString();\n+ public static final String EXTRACT_LIMIT_COUNT_LIMIT_KEY = \"extract.limit.count.limit\";\n+ public static final String EXTRACT_LIMIT_POOL_SIZE_KEY = \"extract.limit.pool.size\";\n \n /**\n * Converter configuration properties.\n\nCodereview: ", "role": "user" }, { "content": "How about putting the config names in the LimiterFactory class? Then it is very clear where they are used. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -111,6 +111,12 @@ public class HoodieWriteConfig extends DefaultHoodieConfig {\n public static final String DEFAULT_EMBEDDED_TIMELINE_SERVER_ENABLED = \"true\";\n public static final String EMBEDDED_TIMELINE_SERVER_PORT = \"hoodie.embed.timeline.server.port\";\n public static final String DEFAULT_EMBEDDED_TIMELINE_SERVER_PORT = \"0\";\n+ public static final String EMBEDDED_TIMELINE_SERVER_THREADS = \"hoodie.embed.timeline.server.threads\";\n+ public static final String DEFAULT_EMBEDDED_TIMELINE_SERVER_THREADS = \"-1\";\n+ public static final String EMBEDDED_TIMELINE_SERVER_COMPRESS_OUTPUT = \"hoodie.embed.timeline.server.gzip\";\n+ public static final String DEFAULT_EMBEDDED_TIMELINE_COMPRESS_OUTPUT = \"true\";\n+ public static final String EMBEDDED_TIMELINE_SERVER_USE_ASYNC = \"hoodie.embed.timeline.server.async\";\n+ public static final String DEFAULT_EMBEDDED_TIMELINE_SERVER_ASYNC = \"false\";\n \n public static final String FAIL_ON_TIMELINE_ARCHIVING_ENABLED_PROP = \"hoodie.fail.on.timeline.archiving\";\n public static final String DEFAULT_FAIL_ON_TIMELINE_ARCHIVING_ENABLED = \"true\";\n\nCodereview: ", "role": "user" }, { "content": "I have faced the same issue with jetty before. we can just turn this to `true` by default. changes seem safe enough. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -92,8 +92,10 @@ public class Constant {\n public static final String NODE_P2P_VERSION = \"node.p2p.version\";\n public static final String NODE_RPC_PORT = \"node.rpc.port\";\n public static final String NODE_RPC_SOLIDITY_PORT = \"node.rpc.solidityPort\";\n+ public static final String NODE_RPC_PBFT_PORT = \"node.rpc.PBFTPort\";\n public static final String NODE_HTTP_FULLNODE_PORT = \"node.http.fullNodePort\";\n public static final String NODE_HTTP_SOLIDITY_PORT = \"node.http.solidityPort\";\n+ public static final String NODE_HTTP_PBFT_PORT = \"node.http.PBFTPort\";\n \n public static final String NODE_RPC_THREAD = \"node.rpc.thread\";\n public static final String NODE_SOLIDITY_THREADS = \"node.solidity.threads\";\n\nCodereview: ", "role": "user" }, { "content": "Be consistent with other configuration items. Since you have node.max**Http**ConnectNumber already, `node.http.PbftPort` is preferred. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -94,6 +94,11 @@ public class HoodieWriteConfig extends DefaultHoodieConfig {\n public static final String BULKINSERT_SORT_MODE = \"hoodie.bulkinsert.sort.mode\";\n public static final String DEFAULT_BULKINSERT_SORT_MODE = BulkInsertSortMode.GLOBAL_SORT\n .toString();\n+ public static final String DELETE_MARKER_FIELD_PROP = \"hoodie.write.delete.marker.field\";\n+ public static final String DEFAULT_DELETE_MARKER_FIELD = \"_hoodie_is_deleted\";\n+\n+ public static final String UPDATE_PARTIAL_FIELDS = \"hoodie.update.partial.fields\";\n+ public static final String DEFAULT_UPDATE_PARTIAL_FIELDS = \"false\";\n \n public static final String EMBEDDED_TIMELINE_SERVER_ENABLED = \"hoodie.embed.timeline.server\";\n public static final String DEFAULT_EMBEDDED_TIMELINE_SERVER_ENABLED = \"true\";\n\nCodereview: ", "role": "user" }, { "content": "Is this needed for this change? what is this used for? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -148,6 +148,10 @@ public final class Const {\n public static final String PATH_CHECKSESSION = \"checksession\";\n \n public static final String URL_PREFIX = \"urlPrefix\";\n- \n+\n public static final String INSTANCE_PUBKEY_PRO = \"publickey\";\n+\n+ public static final String GROUPID = \"io.servicecomb\";\n+\n+ public static final String ARTIFACTID = \"java-chassis\";\n }\nCodereview: ", "role": "user" } ]
d6877a096949d92e
{ "callgraph": "[Start->[Start,Lock,Wait,Debug,Info,Submit,Combine,Unlock,SetRouter],Register->[Type,ApplyUnaryInbound,Unary,Info,NewUnaryHandlerSpec,ApplyOnewayInbound,Oneway,Sprintf,Register,NewOnewayHandlerSpec,Object],Stop->[Debug,Wait,Info,Submit,Combine],ClientConfig->[MultiOutbound],With,UnaryChain,ApplyUnaryOutbound,NewNopContextExtractor,Named,Transports,ValidateServiceName,Error,Sprintf,NewUnary,NewNop,ApplyRouteTable,ApplyOnewayOutbound,String,Namespace]", "msg": "To minimize the possibility of regret, perhaps we name this `ZapLogger`.", "patch": "@@ -72,9 +72,7 @@ type Config struct {\n \n \t// Logger provides a logger for the dispatcher. The default logger is a\n \t// no-op.\n-\t// TODO(shah): Export this when we're ready to deploy a branch in\n-\t// demo-yarpc-go.\n-\tlogger *zap.Logger\n+\tLogger *zap.Logger\n }\n \n // Inbounds contains a list of inbound transports. Each inbound transport", "summary": "Examples of how to configure a new Dispatcher. Easy way to re - enable the EWYY mode." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -975,6 +975,8 @@ type Worker struct {\n \tLabels map[string]string\n \t// Taints is a list of taints for all the `Node` objects in this worker pool.\n \tTaints []corev1.Taint\n+\t// Kubelet contains configuration settings for the kubelet.\n+\tKubelet *KubeletConfig\n }\n \n // Extension contains type and provider information for Shoot extensions.\n\nCodereview: ", "role": "user" }, { "content": "Can you please create a section `Kubernetes` and move the `kubeProxy` settings to it as well (kube-proxy and kubelet are both worker pool specific). </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -111,6 +111,13 @@ type DeploymentConfig struct {\n \t// The reasons for the update to this deployment config.\n \t// This could be based on a change made by the user or caused by an automatic trigger\n \tDetails *DeploymentDetails `json:\"details,omitempty\" yaml:\"details,omitempty\"`\n+\t// Rollback indicates that this is a special deployment config intended to move\n+\t// from an existing deployment state to another previously defined state\n+\tRollback *RollbackConfig `json:\"rollback,omitempty\" yaml:\"rollback,omitempty\"`\n+}\n+\n+type RollbackConfig struct {\n+\tTo string\n }\n \n // DeploymentTemplate contains all the necessary information to create a Deployment from a\n\nCodereview: ", "role": "user" }, { "content": "Why can't this be part of details? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -66,11 +66,14 @@ type MeshCataloger interface {\n \t// ListTrafficPolicies returns all the traffic policies for a given service that Envoy proxy should be aware of.\n \tListTrafficPolicies(service.MeshService) ([]trafficpolicy.TrafficTarget, error)\n \n-\t// ListTrafficPoliciesForServiceAccount returns all inbound and outbound traffic policies related to the given service account\n-\tListTrafficPoliciesForServiceAccount(service.K8sServiceAccount) ([]*trafficpolicy.InboundTrafficPolicy, []*trafficpolicy.OutboundTrafficPolicy, error)\n+\t// ListTrafficPoliciesForServiceAccount returns all inbound traffic policies related to the given service account and inbound services\n+\tListInboundTrafficPolicies(service.K8sServiceAccount, []service.MeshService) []*trafficpolicy.InboundTrafficPolicy\n+\n+\t// ListTrafficPoliciesForServiceAccount returns all outbound traffic policies related to the given service account\n+\tListOutboundTrafficPolicies(service.K8sServiceAccount) []*trafficpolicy.OutboundTrafficPolicy\n \n \t// ListPoliciesForPermissiveMode returns all inbound and outbound traffic policies related to the given services\n-\tListPoliciesForPermissiveMode(services []service.MeshService) ([]*trafficpolicy.InboundTrafficPolicy, []*trafficpolicy.OutboundTrafficPolicy, error)\n+\tListPoliciesForPermissiveMode(services []service.MeshService) ([]*trafficpolicy.InboundTrafficPolicy, []*trafficpolicy.OutboundTrafficPolicy)\n \n \t// ListAllowedInboundServices lists the inbound services allowed to connect to the given service.\n \tListAllowedInboundServices(service.MeshService) ([]service.MeshService, error)\n\nCodereview: ", "role": "user" }, { "content": "Please open an issue to not have a separate API for permissive mode, and rather handle it internally in the catalog. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -414,6 +414,9 @@ type ClusterAutoscaler struct {\n \t// MaxGracefulTerminationSeconds is the number of seconds CA waits for pod termination when trying to scale down a node (default: 600).\n \t// +optional\n \tMaxGracefulTerminationSeconds *int32 `json:\"maxGracefulTerminationSeconds,omitempty\" protobuf:\"varint,9,opt,name=maxGracefulTerminationSeconds\"`\n+\t// IgnoreTaints specifies a list of taint keys to ignore in node templates when considering to scale a node group.\n+\t// +optional\n+\tIgnoreTaints []string `json:\"ignoreTaints,omitempty\" protobuf:\"bytes,10,opt,name=ignoreTaints\"`\n }\n \n // ExpanderMode is type used for Expander values\n\nCodereview: ", "role": "user" }, { "content": "Does it make sense to add some validation for this field? For example preventing that duplicate keys can be specified? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -92,6 +92,9 @@ type StartUpdateResponse struct {\n \n \t// Token is the lease token (if any) to be used to authorize operations on this update.\n \tToken string `json:\"token,omitempty\"`\n+\n+\t// RequiredPolicies is a list of required Policy Packs to run.\n+\tRequiredPolicies []RequiredPolicy `json:\"requiredPolicies,omitempty\"`\n }\n \n // UpdateEventKind is an enum for the type of update events.\n\nCodereview: ", "role": "user" }, { "content": "\"... during the update.\" Question: Is there any proof/guarantee provided by the CLI that the policy pack is actually ran? Or is it really just on the honor system? (And a malicious client could actually not run the required policy packs?) </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -72,9 +72,7 @@ type Config struct {\n \n \t// Logger provides a logger for the dispatcher. The default logger is a\n \t// no-op.\n-\t// TODO(shah): Export this when we're ready to deploy a branch in\n-\t// demo-yarpc-go.\n-\tlogger *zap.Logger\n+\tLogger *zap.Logger\n }\n \n // Inbounds contains a list of inbound transports. Each inbound transport\nCodereview: ", "role": "user" } ]
cd49283116e9b05a
{ "callgraph": "[PlansController->[rollup->[new],destroy->[destroy],create->[new],new->[new],visibility->[visibility],status->[status],get_most_recent->[new]]]", "msg": "Since the IdentifierScheme's don't change without us making additional code changes, perhaps this should be added as a constant as we previously did with Perms?", "patch": "@@ -38,9 +38,13 @@ class PlansController < ApplicationController\n def create\n @plan = Plan.new\n authorize @plan\n-\n+ \n @plan.principal_investigator = current_user.surname.blank? ? nil : \"#{current_user.firstname} #{current_user.surname}\"\n- @plan.data_contact = current_user.email\n+ @plan.principal_investigator_email = current_user.email\n+ \n+ orcid = current_user.identifier_for(IdentifierScheme.find_by(name: 'orcid'))\n+ @plan.principal_investigator_identifier = orcid.identifier unless orcid.nil?\n+ \n @plan.funder_name = plan_params[:funder_name]\n \n @plan.visibility = (plan_params['visibility'].blank? ? Rails.application.config.default_plan_visibility :", "summary": "Creates a new n - word word grammar for the given user. This method is called when the user has used a custom version of the template." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -73,9 +73,8 @@ class ArticlesController < ApplicationController\n \n def edit\n authorize @article\n- @user = @article.user\n+ @organization = @article.user&.organization\n @version = @article.has_frontmatter? ? \"v1\" : \"v2\"\n- @organization = @user&.organization\n end\n \n def manage\n\nCodereview: ", "role": "user" }, { "content": "the `@user` object is never used in the `edit` view, hence we only ask for the `organization` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -88,14 +88,16 @@ class ArticlesController < ApplicationController\n \n def edit\n authorize @article\n+\n @version = @article.has_frontmatter? ? \"v1\" : \"v2\"\n @user = @article.user\n @organizations = @user&.organizations\n end\n \n def manage\n- @article = @article.decorate\n authorize @article\n+\n+ @article = @article.decorate\n @user = @article.user\n @rating_vote = RatingVote.where(article_id: @article.id, user_id: @user.id).first\n @buffer_updates = BufferUpdate.where(composer_user_id: @user.id, article_id: @article.id)\n\nCodereview: ", "role": "user" }, { "content": "Why did you move this line below line 98 rather than leaving it above it on line 97? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -103,7 +103,9 @@ class Game < Base\n \n def to_h(include_actions: false, player: nil)\n actions_h = include_actions ? actions.map(&:to_h) : []\n- settings_h = include_actions ? settings.to_h : {}\n+ settings_h = settings.to_h\n+\n+ settings_h.delete('seed') unless include_actions\n \n # Move user settings and hide from other players\n user_settings_h = settings_h.dig('players', player)\n\nCodereview: ", "role": "user" }, { "content": "why do we delete seed? just keep it in. once you make this change go ahead and merge </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -159,8 +159,8 @@ class EpisodeRecord < ApplicationRecord\n \n def twitter_share_body\n work_title = work.local_title\n- title = self.comment.present? ? work_title.truncate(30) : work_title\n- comment = self.comment.present? ? \"#{self.comment} / \" : \"\"\n+ title = self.body.present? ? work_title.truncate(30) : work_title\n+ comment = self.body.present? ? \"#{self.body} / \" : \"\"\n episode_number = episode.local_number\n share_url = share_url_with_query(:twitter)\n share_hashtag = work.hashtag_with_hash\n\nCodereview: ", "role": "user" }, { "content": "Style/RedundantSelf: Redundant self detected. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -159,8 +159,8 @@ class EpisodeRecord < ApplicationRecord\n \n def twitter_share_body\n work_title = work.local_title\n- title = self.comment.present? ? work_title.truncate(30) : work_title\n- comment = self.comment.present? ? \"#{self.comment} / \" : \"\"\n+ title = self.body.present? ? work_title.truncate(30) : work_title\n+ comment = self.body.present? ? \"#{self.body} / \" : \"\"\n episode_number = episode.local_number\n share_url = share_url_with_query(:twitter)\n share_hashtag = work.hashtag_with_hash\n\nCodereview: ", "role": "user" }, { "content": "Style/RedundantSelf: Redundant self detected. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -38,9 +38,13 @@ class PlansController < ApplicationController\n def create\n @plan = Plan.new\n authorize @plan\n-\n+ \n @plan.principal_investigator = current_user.surname.blank? ? nil : \"#{current_user.firstname} #{current_user.surname}\"\n- @plan.data_contact = current_user.email\n+ @plan.principal_investigator_email = current_user.email\n+ \n+ orcid = current_user.identifier_for(IdentifierScheme.find_by(name: 'orcid'))\n+ @plan.principal_investigator_identifier = orcid.identifier unless orcid.nil?\n+ \n @plan.funder_name = plan_params[:funder_name]\n \n @plan.visibility = (plan_params['visibility'].blank? ? Rails.application.config.default_plan_visibility :\nCodereview: ", "role": "user" } ]
f60d879bbc59089b
{ "callgraph": "[CommandDispatcher->[move_to_next_line->[_current_widget],view_source->[show_source_cb->[_current_url],_current_widget],search_prev->[_current_widget,search],back->[_back_forward],move_to_prev_line->[_current_widget],_parse_url_input->[_parse_url],paste->[_open],scroll_perc->[_current_widget],move_to_next_word->[_current_widget],quickmark_del->[_current_url],open_editor->[_current_widget],drop_selection->[_current_widget],fake_key->[_current_widget],download->[_current_widget,_current_url],move_to_end_of_line->[_current_widget],zoom->[_current_widget],_cntwidget->[_count],debug_clear_ssl_errors->[_current_widget],move_to_end_of_document->[_current_widget],navigate->[_current_widget,_open,_current_url],zoom_in->[_current_widget],scroll_px->[_current_widget],move_to_end_of_next_block->[_current_widget],jump_mark->[jump_mark],stop->[_cntwidget,stop],search_next->[_current_widget,search],click_element->[_current_widget],jseval->[_current_widget],bookmark_del->[_current_url],move_to_next_char->[_current_widget],_yank_url->[_current_url],insert_text->[_insert_text_cb->[insert_text],_current_widget],move_to_end_of_prev_block->[_current_widget],tab_close->[_cntwidget,_get_selection_override],move_to_end_of_word->[_current_widget],bookmark_add->[_current_url,_current_title],show_help->[_open],move_to_prev_word->[_current_widget],move_to_start_of_next_block->[_current_widget],edit_url->[_current_url],home->[openurl],move_to_start_of_prev_block->[_current_widget],tab_move->[_current_widget,_current_index,_set_current_index,_count],openurl->[openurl,_cntwidget,_open],debug_webaction->[_current_widget],_tab_focus_last->[_set_current_index],toggle_inspector->[_current_widget],tab_next->[_current_index,_set_current_index,_count],move_to_start_of_document->[_current_widget],quickmark_load->[_open],zoom_out->[_current_widget],scroll_page->[_current_widget,navigate],move_to_start_of_line->[_current_widget],tab_detach->[_current_url,_open,_current_widget,_count],tab_focus->[_set_current_index,_count,tab_next,_tab_focus_last],bookmark_load->[_open],follow_selected->[_current_widget],quickmark_save->[_current_url],_open_if_changed->[openurl],reloadpage->[_cntwidget],set_mark->[set_mark],_back_forward->[_current_widget,tab_clone],_run_userscript->[_current_index],_download_mhtml->[_current_widget,_current_title],scroll->[_current_widget],tab_clone->[_current_widget,_current_index,_new_tabbed_browser],_open->[_new_tabbed_browser,_current_widget],printpage->[_cntwidget],forward->[_back_forward],debug_dump_page->[_current_widget],undo->[undo],messages->[_open],search->[_current_widget,search],yank->[_current_url,_current_index,_yank_url,_current_widget],move_to_prev_char->[_current_widget],tab_prev->[_current_index,_set_current_index,_count],toggle_selection->[_current_widget]]]", "msg": "You can most likely remove that (and the try/finally) too, as we shouldn't have any flickering from removing/inserting tabs anymore now.", "patch": "@@ -1028,17 +1028,13 @@ class CommandDispatcher:\n raise cmdexc.CommandError(\"Can't move tab to position {}!\".format(\n new_idx + 1))\n \n- tab = self._current_widget()\n cur_idx = self._current_index()\n- icon = self._tabbed_browser.tabIcon(cur_idx)\n- label = self._tabbed_browser.page_title(cur_idx)\n cmdutils.check_overflow(cur_idx, 'int')\n cmdutils.check_overflow(new_idx, 'int')\n self._tabbed_browser.setUpdatesEnabled(False)\n try:\n color = self._tabbed_browser.tab_indicator_color(cur_idx)\n- self._tabbed_browser.removeTab(cur_idx)\n- self._tabbed_browser.insertTab(new_idx, tab, icon, label)\n+ self._tabbed_browser.tabBar().moveTab(cur_idx, new_idx)\n self._set_current_index(new_idx)\n self._tabbed_browser.set_tab_indicator_color(new_idx, color)\n finally:", "summary": "Move the current tab according to the argument and [ count. Set current tab indicator color and update tabbed browser." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -222,7 +222,7 @@ namespace Dynamo.Controls\n // creates a new tab item\n tab = new TabItem();\n tab.Header = viewExtension.Name;\n- tab.Tag = viewExtension.GetType();\n+ tab.Tag = viewExtension;\n tab.Uid = viewExtension.UniqueId;\n tab.HeaderTemplate = tabDynamic.FindResource(\"TabHeader\") as DataTemplate;\n \n\nCodereview: ", "role": "user" }, { "content": "Can we consider if this causes any memory leak issues? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -227,6 +227,7 @@ namespace Dynamo.Controls\n TabItem tab = new TabItem();\n tab.Header = viewExtension.Name;\n tab.Tag = viewExtension.GetType();\n+ tab.Uid = viewExtension.UniqueId;\n tab.HeaderTemplate = tabDynamic.FindResource(\"TabHeader\") as DataTemplate;\n \n // setting the extension UI to the current tab content \n\nCodereview: ", "role": "user" }, { "content": "are we going to stick to name or use this? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -29,16 +29,13 @@ class E2EELabel extends Component<Props> {\n return null;\n }\n \n- // eslint-disable-next-line react/jsx-max-props-per-line\n- const icon = <Icon size = { 22 } src = { IconE2EE } />;\n-\n return (\n <Tooltip\n content = { this.props.t('e2ee.labelToolTip') }\n position = { 'left' }>\n <CircularLabel\n className = 'e2ee'\n- label = { icon } />\n+ icon = { IconE2EE } />\n </Tooltip>\n );\n }\n\nCodereview: ", "role": "user" }, { "content": "how about the size now? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -215,8 +215,16 @@ namespace Dynamo.Controls\n tab.Tag = viewExtension.GetType();\n tab.HeaderTemplate = tabDynamic.FindResource(\"TabHeader\") as DataTemplate;\n \n- // setting the extension window to the current tab content\n- tab.Content = contentControl.Content;\n+ // setting the extension UI to the current tab content \n+ // based on whether it is a UserControl element or window element. \n+ if (contentControl.Template.TargetType.Name.Equals(new UserControl().GetType().Name))\n+ {\n+ tab.Content = contentControl;\n+ }\n+ else\n+ {\n+ tab.Content = contentControl.Content;\n+ }\n \n //Insert the tab at the end\n TabItems.Insert(count, tab);\n\nCodereview: ", "role": "user" }, { "content": "`if (contentControl is UserControl)`, you can compare type directly? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -701,7 +701,12 @@ define([\n var color = queryColorValue(node, 'color', namespaces.kml);\n \n var iconNode = queryFirstNode(node, 'Icon', namespaces.kml);\n- var icon = getIconHref(iconNode, dataSource, sourceUri, uriResolver, false, query);\n+ var icon;\n+ if (!defined(iconNode)) {\n+ icon = dataSource._pinBuilder.fromColor(Color.YELLOW, 64);\n+ } else {\n+ icon = getIconHref(iconNode, dataSource, sourceUri, uriResolver, false, query);\n+ }\n var x = queryNumericValue(iconNode, 'x', namespaces.gx);\n var y = queryNumericValue(iconNode, 'y', namespaces.gx);\n var w = queryNumericValue(iconNode, 'w', namespaces.gx);\n\nCodereview: ", "role": "user" }, { "content": "What situation does this address that isn't addressed below? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1028,17 +1028,13 @@ class CommandDispatcher:\n raise cmdexc.CommandError(\"Can't move tab to position {}!\".format(\n new_idx + 1))\n \n- tab = self._current_widget()\n cur_idx = self._current_index()\n- icon = self._tabbed_browser.tabIcon(cur_idx)\n- label = self._tabbed_browser.page_title(cur_idx)\n cmdutils.check_overflow(cur_idx, 'int')\n cmdutils.check_overflow(new_idx, 'int')\n self._tabbed_browser.setUpdatesEnabled(False)\n try:\n color = self._tabbed_browser.tab_indicator_color(cur_idx)\n- self._tabbed_browser.removeTab(cur_idx)\n- self._tabbed_browser.insertTab(new_idx, tab, icon, label)\n+ self._tabbed_browser.tabBar().moveTab(cur_idx, new_idx)\n self._set_current_index(new_idx)\n self._tabbed_browser.set_tab_indicator_color(new_idx, color)\n finally:\nCodereview: ", "role": "user" } ]
5adca273356e738b
{ "callgraph": "[StringConfigurationSource->[GetDouble->[GetString],GetInt32->[GetString],GetBool->[GetString],GetDictionary->[ParseCustomKeyValues,GetString]]]", "msg": "I looks like we can make `allowOptionalMappings` non-optional since we have another overload without it. (I thought this generated a compiler warning, but maybe it's just R#)", "patch": "@@ -17,6 +17,18 @@ namespace Datadog.Trace.Configuration\n /// <param name=\"data\">A string containing key-value pairs which are comma-separated, and for which the key and value are colon-separated.</param>\n /// <returns><see cref=\"IDictionary{TKey, TValue}\"/> of key value pairs.</returns>\n public static IDictionary<string, string> ParseCustomKeyValues(string data)\n+ {\n+ return ParseCustomKeyValues(data, allowOptionalMappings: false);\n+ }\n+\n+ /// <summary>\n+ /// Returns a <see cref=\"IDictionary{TKey, TValue}\"/> from parsing\n+ /// <paramref name=\"data\"/>.\n+ /// </summary>\n+ /// <param name=\"data\">A string containing key-value pairs which are comma-separated, and for which the key and value are colon-separated.</param>\n+ /// <param name=\"allowOptionalMappings\">Determines whether to create dictionary entries when the input has no value mapping</param>\n+ /// <returns><see cref=\"IDictionary{TKey, TValue}\"/> of key value pairs.</returns>\n+ public static IDictionary<string, string> ParseCustomKeyValues(string data, bool allowOptionalMappings = false)\n {\n var dictionary = new ConcurrentDictionary<string, string>();\n ", "summary": "ParseCustomKeyValues - Parses a string into a dictionary of key - value pairs." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -29,5 +29,15 @@ namespace System.Runtime.InteropServices\n /// </remarks>\n public static ref TValue GetValueRefOrNullRef<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key) where TKey : notnull\n => ref dictionary.FindValue(key);\n+\n+ /// <summary>\n+ /// Gets a ref to a <typeparamref name=\"TValue\"/> in the <see cref=\"Dictionary{TKey, TValue}\"/>, adding a new entry with a default value if it does not exist in the <paramref name=\"dictionary\"/>.\n+ /// </summary>\n+ /// <param name=\"dictionary\">The dictionary to get the ref to <typeparamref name=\"TValue\"/> from.</param>\n+ /// <param name=\"key\">The key used for lookup.</param>\n+ /// <param name=\"exists\">Whether or not a new entry for the given key was added to the dictionary.</param>\n+ /// <remarks>Items should not be added to or removed from the <see cref=\"Dictionary{TKey, TValue}\"/> while the ref <typeparamref name=\"TValue\"/> is in use.</remarks>\n+ public static ref TValue? GetValueRefOrAddDefault<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, out bool exists) where TKey : notnull\n+ => ref Dictionary<TKey, TValue>.CollectionsMarshalHelper.GetValueRefOrAddDefault(dictionary, key, out exists);\n }\n }\n\nCodereview: ", "role": "user" }, { "content": "Grammar: should read \"added to or removed from\" </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -9,5 +9,10 @@ namespace NServiceBus.Faults\n /// Header key for setting/getting the queue at which the message processing failed.\n /// </summary>\n public const string FailedQ = \"NServiceBus.FailedQ\";\n+\n+ /// <summary>\n+ /// Header key for communicating <see cref=\"SecondLevelRetriesProcessor\"/> the value for <see cref=\"FailedQ\"/> header.\n+ /// </summary>\n+ public const string TemporatyFailedQueue = \"NServiceBus.TemporatyFailedQueue\";\n }\n }\n\\ No newline at end of file\n\nCodereview: ", "role": "user" }, { "content": "@SzymonPobiega - you have a typo in the queue name and the variable name :) </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -12,12 +12,12 @@\n /// <summary>\n /// \n /// </summary>\n- /// <param name=\"configuration\">The BusConfiguration instance.</param>\n+ /// <param name=\"configuration\">The EndpointConfiguration instance.</param>\n /// <param name=\"settings\">A string dictionary of settings from the RunDescriptor specifying Transport, Persistence,\n /// connection strings, Serializer, Builder, and other details. Transports must call configuration.UseTransport&lt;T&gt;().\n /// Persistence must call configuration.UsePersistence&lt;T&gt;(). </param>\n /// <returns>An async Task.</returns>\n- Task Configure(BusConfiguration configuration, IDictionary<string, string> settings);\n+ Task Configure(EndpointConfiguration configuration, IDictionary<string, string> settings);\n \n /// <summary>\n /// Gives the transport/persistence a chance to clean up after the test is complete. Implementors of this class may store\n\nCodereview: ", "role": "user" }, { "content": "nitpicking, but this could use a `<see cref=\"...\" />` ? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -17,14 +17,14 @@ namespace Microsoft.Extensions.Configuration\n /// <param name=\"key\">The key.</param>\n /// <param name=\"value\">The value.</param>\n /// <returns><c>True</c> if a value for the specified key was found, otherwise <c>false</c>.</returns>\n- bool TryGet(string key, out string value);\n+ bool TryGet(string key, [MaybeNullWhen(false)] out string value);\n \n /// <summary>\n /// Sets a configuration value for the specified key.\n /// </summary>\n /// <param name=\"key\">The key.</param>\n /// <param name=\"value\">The value.</param>\n- void Set(string key, string value);\n+ void Set(string key, string? value);\n \n /// <summary>\n /// Returns a change token if this provider supports change tracking, null otherwise.\n\nCodereview: ", "role": "user" }, { "content": "I think it would be more consistent (i.e. with dictionary) for this to be nullable with `NotNullWhen(true)` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -20,11 +20,11 @@ namespace System.Text.Json.Nodes\n /// <returns>\n /// The new instance of the <see cref=\"JsonValue\"/> class that contains the specified value.\n /// </returns>\n- /// <typeparam name=\"T\">The type of value to be added.</typeparam>\n- /// <param name=\"value\">The value to add.</param>\n+ /// <typeparam name=\"T\">The type of value to create.</typeparam>\n+ /// <param name=\"value\">The value to create.</param>\n /// <param name=\"options\">Options to control the behavior.</param>\n /// <returns>The new instance of the <see cref=\"JsonValue\"/> class that contains the specified value.</returns>\n- public static JsonValue? Create<T>(T? value, JsonNodeOptions? options = null)\n+ public static JsonValue? Create<[DynamicallyAccessedMembers(JsonHelpers.MembersAccessedOnRead)]T>(T? value, JsonNodeOptions? options = null)\n {\n if (value == null)\n {\n\nCodereview: ", "role": "user" }, { "content": "I thought we were going to mark this as `RequiresUnreferencedCode`. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -17,6 +17,18 @@ namespace Datadog.Trace.Configuration\n /// <param name=\"data\">A string containing key-value pairs which are comma-separated, and for which the key and value are colon-separated.</param>\n /// <returns><see cref=\"IDictionary{TKey, TValue}\"/> of key value pairs.</returns>\n public static IDictionary<string, string> ParseCustomKeyValues(string data)\n+ {\n+ return ParseCustomKeyValues(data, allowOptionalMappings: false);\n+ }\n+\n+ /// <summary>\n+ /// Returns a <see cref=\"IDictionary{TKey, TValue}\"/> from parsing\n+ /// <paramref name=\"data\"/>.\n+ /// </summary>\n+ /// <param name=\"data\">A string containing key-value pairs which are comma-separated, and for which the key and value are colon-separated.</param>\n+ /// <param name=\"allowOptionalMappings\">Determines whether to create dictionary entries when the input has no value mapping</param>\n+ /// <returns><see cref=\"IDictionary{TKey, TValue}\"/> of key value pairs.</returns>\n+ public static IDictionary<string, string> ParseCustomKeyValues(string data, bool allowOptionalMappings = false)\n {\n var dictionary = new ConcurrentDictionary<string, string>();\n \nCodereview: ", "role": "user" } ]
7a9e0d491239446f
{ "callgraph": "[ConfigUtil->[installDynamicConfig->[createDynamicConfig],createDynamicConfig->[duplicateServiceCombConfigToCse,createConfigFromConfigCenter,createLocalConfig],getMicroserviceConfigLoader->[getProperty],convertEnvVariable->[getProperty],duplicateServiceCombConfigToCse->[duplicateServiceCombConfigToCse,getProperty],getProperty->[getProperty],createLocalConfig->[setMicroserviceConfigLoader,createLocalConfig]]]", "msg": "I think if we can provide a more convenient method to add configs . e.g. public static void addConfig(String k, Object v)", "patch": "@@ -52,9 +52,15 @@ public final class ConfigUtil {\n \n private static final String MICROSERVICE_CONFIG_LOADER_KEY = \"cse-microservice-config-loader\";\n \n+ private static ConfigModel model = new ConfigModel();\n+\n private ConfigUtil() {\n }\n \n+ public static void setConfigs(Map<String, Object> config) {\n+ model.setConfig(config);\n+ }\n+\n public static Object getProperty(String key) {\n Object config = DynamicPropertyFactory.getBackingConfigurationSource();\n return getProperty(config, key);", "summary": "Get a property from the configuration source." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -38,14 +38,7 @@ import java.util.regex.Pattern;\n */\n public class MapBasedRow implements Row\n {\n- private static final Logger log = new Logger(MapBasedRow.class);\n- private static final Function<Object, String> TO_STRING_INCLUDING_NULL = new Function<Object, String>() {\n- @Override\n- public String apply(final Object o)\n- {\n- return String.valueOf(o);\n- }\n- };\n+ private static final Function<Object, String> TO_STRING_INCLUDING_NULL = o -> String.valueOf(o);\n \n private final DateTime timestamp;\n private final Map<String, Object> event;\n\nCodereview: ", "role": "user" }, { "content": "Could be method ref `String::valueOf` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -90,11 +90,10 @@ public class PropertyUtil {\n }\n }\n \n-\n- private static String capitalizeFirstLetter(final String aString) {\n- char first = aString.charAt(0);\n+ private static String capitalizeFirstLetter(final String str) {\n+ char first = str.charAt(0);\n first = Character.toUpperCase(first);\n- return first + aString.substring(1);\n+ return first + str.substring(1);\n }\n \n private static Method getSetter(final String propertyName, final Object subject, final Object value) {\n\nCodereview: ", "role": "user" }, { "content": "nit: prefer `str` to be spelled out, or renamed dto someting like `input`, but NBD </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -20,6 +20,10 @@ public class CredentialsMaskUtilTestCase\n private static final String URL_TEST = \"jdbc:sqlserver://1.1.1.1:1443;databaseName=STAGING;user=mulesoftuser;password=mulesoftpass;\";\n \n private static final String EXPECTED_URL_TEST_MASKED = \"jdbc:sqlserver://1.1.1.1:1443;databaseName=STAGING;user=<<user>>;password=<<credentials>>;\";\n+ \n+ private static final String URI_SPECIAL_CHARACTERS_AUTHORITY = \"sftp://user:Deloitte@alskdalaks@@hol@localhost:22/home/user/\";\n+\n+ private static final String EXPECTED_URI_MASKED = \"sftp://<<credentials>>@localhost:22/home/user/\";\n \n @Test\n public void whenUrlWithUserAndPasswordMaskUserPassword()\n\nCodereview: ", "role": "user" }, { "content": "is this a valid url? don't the `@` in the password have to be masked? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -87,7 +87,7 @@ public class ExplicitUnlockTest extends SingleCacheManagerTest {\n \n private static class Worker implements Callable<Boolean> {\n \n- private static String lockKey = \"0\"; // there is no cached Object with such key\n+ private static final String lockKey = \"0\"; // there is no cached Object with such key\n private final Cache<Object, Object> cache;\n private final boolean withUnlock;\n private final long stepDelayMsec;\n\nCodereview: ", "role": "user" }, { "content": "IMO this should be in the Test class, because the Worker cannot guarantee that the key does not exist in the cache by itself. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -47,8 +47,13 @@ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object>\n \n private static final String WEBSOCKET_PATH = \"/websocket\";\n \n+ private final Set<ChannelHandler> httpHandlers;\n private WebSocketServerHandshaker handshaker;\n \n+ public WebSocketServerHandler(Set<ChannelHandler> httpHandlers) {\n+ this.httpHandlers = httpHandlers;\n+ }\n+\n @Override\n public void channelRead0(ChannelHandlerContext ctx, Object msg) {\n if (msg instanceof FullHttpRequest) {\n\nCodereview: ", "role": "user" }, { "content": "- Is this constructor supposed to be public? If not, let's make it package-local - This effectively removes the default constructor. Is this intended? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -52,9 +52,15 @@ public final class ConfigUtil {\n \n private static final String MICROSERVICE_CONFIG_LOADER_KEY = \"cse-microservice-config-loader\";\n \n+ private static ConfigModel model = new ConfigModel();\n+\n private ConfigUtil() {\n }\n \n+ public static void setConfigs(Map<String, Object> config) {\n+ model.setConfig(config);\n+ }\n+\n public static Object getProperty(String key) {\n Object config = DynamicPropertyFactory.getBackingConfigurationSource();\n return getProperty(config, key);\nCodereview: ", "role": "user" } ]
9833722d3af985a8
{ "callgraph": "[createInfoStore,registerStore,addQueryArgs,dispatch,it,describe,createTestRegistry,select,unsubscribeFromAll,beforeEach,expect,afterEach]", "msg": "Minor detail, but let's use the interpolated template string syntax instead.", "patch": "@@ -30,6 +30,7 @@ import { STORE_NAME as CORE_SITE } from '../datastore/site/constants';\n import { STORE_NAME as CORE_USER } from '../datastore/user/constants';\n \n const MODULE_SLUG = 'test-slug';\n+const TEST_STORE_NAME = 'test/' + MODULE_SLUG;\n \n describe( 'createInfoStore store', () => {\n \tlet registry;", "summary": "Info datastore functions tests. requires that the main module is created." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -1,6 +1,7 @@\n import { default as getURL, getURLWithCDN } from \"discourse-common/lib/get-url\";\n import { run } from \"@ember/runloop\";\n import { ajax } from \"discourse/lib/ajax\";\n+import { PUBLIC_JS_VERSIONS } from \"discourse/lib/public_js_versions\";\n import { Promise } from \"rsvp\";\n \n const _loaded = {};\n\nCodereview: ", "role": "user" }, { "content": "In the js world we use `kebab-case` (dasherize) for module names. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1,7 +1,6 @@\n import AnalyticsClient from './analytics.js';\n import { default as CookieOrginal } from 'js-cookie';\n import glob from '../../../jest/global';\n-import { describe } from 'jest-circus';\n \n jest.mock('js-cookie');\n const Cookie = CookieOrginal;\n\nCodereview: ", "role": "user" }, { "content": "this was probably automatically imported by my VS Code </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -114,6 +114,7 @@ import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay\n import { suspendDetected } from './react/features/power-monitor';\n import { setSharedVideoStatus } from './react/features/shared-video';\n import { endpointMessageReceived } from './react/features/subtitles';\n+import { getPresenterEffect } from './react/features/presenter';\n \n const logger = require('jitsi-meet-logger').getLogger(__filename);\n \n\nCodereview: ", "role": "user" }, { "content": "style: sort alphabetically by path </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -109,6 +109,7 @@ import {\n } from './react/features/overlay';\n import { setSharedVideoStatus } from './react/features/shared-video';\n import { isButtonEnabled } from './react/features/toolbox';\n+import { endpointMessageReceived } from './react/features/subtitles';\n \n const logger = require('jitsi-meet-logger').getLogger(__filename);\n \n\nCodereview: ", "role": "user" }, { "content": "I wonder if endpointMessageReceived should be located somewhere other than subtitles if the endpoint messages could be used for more than subtitles. I suppose it doesn't hurt to keep it in subtitles for now though. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1,6 +1,6 @@\n import Vue from 'vue';\n-import { format, parseISO, formatDuration } from 'date-fns';\n-import * as duration from 'duration-fns';\n+import { format, parseISO } from 'date-fns';\n+import * as moment from 'moment';\n \n export const DATE_FORMAT = 'yyyy-MM-dd';\n export const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm';\n\nCodereview: ", "role": "user" }, { "content": "Why do we use both libs? One lib isn't enough? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -30,6 +30,7 @@ import { STORE_NAME as CORE_SITE } from '../datastore/site/constants';\n import { STORE_NAME as CORE_USER } from '../datastore/user/constants';\n \n const MODULE_SLUG = 'test-slug';\n+const TEST_STORE_NAME = 'test/' + MODULE_SLUG;\n \n describe( 'createInfoStore store', () => {\n \tlet registry;\nCodereview: ", "role": "user" } ]
68f36e4be46f4cce
{ "callgraph": "[AllDataFilesTable->[AllDataFilesTableScan->[newRefinedScan->[AllDataFilesTableScan],planFiles->[schema]]]]", "msg": "I think these can all be .name() to get the value we are looking for", "patch": "@@ -84,6 +84,11 @@ public class AllDataFilesTable extends BaseMetadataTable {\n this.fileSchema = fileSchema;\n }\n \n+ @Override\n+ protected String tableType() {\n+ return String.valueOf(MetadataTableType.ALL_DATA_FILES);\n+ }\n+\n @Override\n protected TableScan newRefinedScan(TableOperations ops, Table table, Schema schema, TableScanContext context) {\n return new AllDataFilesTableScan(ops, table, schema, fileSchema, context);", "summary": "Create a new scan for the given table and schema." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -94,14 +94,14 @@ public class CreateEmptyPartitionProcedure\n CREATE_EMPTY_PARTITION.bindTo(this));\n }\n \n- public void createEmptyPartition(ConnectorSession session, String schema, String table, List<String> partitionColumnNames, List<String> partitionValues)\n+ public void createEmptyPartition(ConnectorSession session, ConnectorAccessControl accessControl, String schema, String table, List<String> partitionColumnNames, List<String> partitionValues)\n {\n try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(getClass().getClassLoader())) {\n- doCreateEmptyPartition(session, schema, table, partitionColumnNames, partitionValues);\n+ doCreateEmptyPartition(session, accessControl, schema, table, partitionColumnNames, partitionValues);\n }\n }\n \n- private void doCreateEmptyPartition(ConnectorSession session, String schemaName, String tableName, List<String> partitionColumnNames, List<String> partitionValues)\n+ private void doCreateEmptyPartition(ConnectorSession session, ConnectorAccessControl accessControl, String schemaName, String tableName, List<String> partitionColumnNames, List<String> partitionValues)\n {\n TransactionalMetadata hiveMetadata = hiveMetadataFactory.create();\n HiveTableHandle tableHandle = (HiveTableHandle) hiveMetadata.getTableHandle(session, new SchemaTableName(schemaName, tableName));\n\nCodereview: ", "role": "user" }, { "content": "Use `SchemaTableName` to format the error message, as above. Maybe extract a variable for the existing `new SchemaTableName(...)` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -192,6 +192,10 @@ public abstract class HoodieWriteHandle<T extends HoodieRecordPayload> extends H\n \n protected HoodieFileWriter createNewFileWriter(String instantTime, Path path, HoodieTable<T> hoodieTable,\n HoodieWriteConfig config, Schema schema, SparkTaskContextSupplier sparkTaskContextSupplier) throws IOException {\n- return HoodieFileWriterFactory.getFileWriter(instantTime, path, hoodieTable, config, schema, sparkTaskContextSupplier);\n+ if (config.updatePartialFields() && !StringUtils.isNullOrEmpty(config.getLastSchema())) {\n+ return HoodieFileWriterFactory.getFileWriter(instantTime, path, hoodieTable, config, new Schema.Parser().parse(config.getLastSchema()), sparkTaskContextSupplier);\n+ } else {\n+ return HoodieFileWriterFactory.getFileWriter(instantTime, path, hoodieTable, config, schema, sparkTaskContextSupplier);\n+ }\n }\n }\n\nCodereview: ", "role": "user" }, { "content": "same question as above, is it better to override this only in MergeHandle? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -47,6 +47,11 @@ public class KsqlStream extends StructuredDataSource {\n return new KsqlStream(dataSourceName, schema, keyField, newTimestampField.get(), ksqlTopic);\n }\n \n+ @Override\n+ public QueryId getPersistentQueryId() {\n+ return new QueryId(\"CSAS_\" + dataSourceName);\n+ }\n+\n @Override\n public String toString() {\n return getClass().getSimpleName() + \" name:\" + getName();\n\nCodereview: ", "role": "user" }, { "content": "For my understanding, what would be the `dataSourceName` in a statement like `CREATE STREAM enriched_pv as SELECT users.userid AS userid, pageid, region FROM pageviews LEFT JOIN users ON pageviews.userid = users.userid;` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -151,6 +151,18 @@ public class TestExternalHiveTable\n query(format(\"CREATE TABLE %s.%s.%s WITH (external_location = '%s') AS SELECT * FROM tpch.tiny.nation\", HIVE_CATALOG_WITH_EXTERNAL_WRITES, schema, table, tableLocation));\n }\n \n+ @Test(groups = {HIVE_WITH_EXTERNAL_WRITES, PROFILE_SPECIFIC_TESTS})\n+ public void testCreateExternalTableWithNoSchemaLocation()\n+ {\n+ String schema = \"schema_without_location\";\n+ query(format(\"DROP SCHEMA IF EXISTS %s.%s\", HIVE_CATALOG_WITH_EXTERNAL_WRITES, schema));\n+ query(format(\"CREATE SCHEMA %s.%s\", HIVE_CATALOG_WITH_EXTERNAL_WRITES, schema));\n+\n+ String table = \"test_create_external\";\n+ String tableLocation = \"/tmp/\" + table;\n+ query(format(\"CREATE TABLE %s.%s.%s WITH (external_location = '%s') AS SELECT * FROM tpch.tiny.nation\", HIVE_CATALOG_WITH_EXTERNAL_WRITES, schema, table, tableLocation));\n+ }\n+\n private void insertNationPartition(TableInstance<?> nation, int partition)\n {\n onHive().executeQuery(\n\nCodereview: ", "role": "user" }, { "content": "Won't this schema have an implicit location of `/usr/hive/warehose/schema_without_location.db` ? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -96,9 +96,14 @@ public abstract class HoodieLazyInsertIterable<T extends HoodieRecordPayload>\n * Transformer function to help transform a HoodieRecord. This transformer is used by BufferedIterator to offload some\n * expensive operations of transformation to the reader thread.\n */\n+ static <T extends HoodieRecordPayload> Function<HoodieRecord<T>, HoodieInsertValueGenResult<HoodieRecord>> getTransformFunction(\n+ Schema schema, HoodieWriteConfig config) {\n+ return hoodieRecord -> new HoodieInsertValueGenResult(hoodieRecord, schema, config.getProps());\n+ }\n+\n static <T extends HoodieRecordPayload> Function<HoodieRecord<T>, HoodieInsertValueGenResult<HoodieRecord>> getTransformFunction(\n Schema schema) {\n- return hoodieRecord -> new HoodieInsertValueGenResult(hoodieRecord, schema);\n+ return hoodieRecord -> new HoodieInsertValueGenResult(hoodieRecord, schema, CollectionUtils.EMPTY_PROPERTIES);\n }\n \n @Override\n\nCodereview: ", "role": "user" }, { "content": "this is a function invoked per record. so could we avoid the empty `new Properties` allocation each time, to reduce overhead on each record </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -84,6 +84,11 @@ public class AllDataFilesTable extends BaseMetadataTable {\n this.fileSchema = fileSchema;\n }\n \n+ @Override\n+ protected String tableType() {\n+ return String.valueOf(MetadataTableType.ALL_DATA_FILES);\n+ }\n+\n @Override\n protected TableScan newRefinedScan(TableOperations ops, Table table, Schema schema, TableScanContext context) {\n return new AllDataFilesTableScan(ops, table, schema, fileSchema, context);\nCodereview: ", "role": "user" } ]
c733dad0abcbf8f4
{ "callgraph": "[applyProgramsToDirtyDataInterfaces->[setAcceptLocal]]", "msg": "nit: a switch perhaps?", "patch": "@@ -614,6 +614,8 @@ func (m *bpfEndpointManager) attachDataIfaceProgram(ifaceName string, polDirecti\n \tepType := tc.EpTypeHost\n \tif ifaceName == \"tunl0\" {\n \t\tepType = tc.EpTypeTunnel\n+\t} else if ifaceName == \"wireguard.cali\" {\n+\t\tepType = tc.EpTypeWireguard\n \t}\n \tap := m.calculateTCAttachPoint(epType, polDirection, ifaceName)\n \tap.HostIP = m.hostIP", "summary": "attachDataIfaceProgram attaches the data interface program to the endpoint." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -101,12 +101,10 @@ func (m MapStr) Clone() MapStr {\n \tresult := MapStr{}\n \n \tfor k, v := range m {\n-\t\tinnerMap, err := toMapStr(v)\n-\t\tif err == nil {\n-\t\t\tresult[k] = innerMap.Clone()\n-\t\t} else {\n-\t\t\tresult[k] = v\n+\t\tif innerMap, ok := tryToMapStr(v); ok {\n+\t\t\tv = innerMap.Clone()\n \t\t}\n+\t\tresult[k] = v\n \t}\n \n \treturn result\n\nCodereview: ", "role": "user" }, { "content": "Kind of surprised to see a mapstr change in this PR. Why was that needed? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -382,6 +382,9 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil\n \t}\n \n \tcontainerConfig := registry.PodmanConfig()\n+\tfor _, arg := range containerConfig.RuntimeFlags {\n+\t\truntimeFlags = append(runtimeFlags, \"--\"+arg)\n+\t}\n \tif containerConfig.Engine.CgroupManager == config.SystemdCgroupsManager {\n \t\truntimeFlags = append(runtimeFlags, \"--systemd-cgroup\")\n \t}\n\nCodereview: ", "role": "user" }, { "content": "Is this correct? It looks questionable </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -491,6 +491,8 @@ func (m *ChatRemoteMock) PostRemote(ctx context.Context, arg chat1.PostRemoteArg\n \tconv := m.world.GetConversationByID(arg.ConversationID)\n \tri := m.makeReaderInfo(conv.Metadata.ConversationID)\n \tinserted := m.insertMsgAndSort(arg.ConversationID, arg.MessageBoxed)\n+\tm.world.T.Logf(\"PostRemote(convid:%v, msgid:%v, %v)\",\n+\t\targ.ConversationID, inserted.ServerHeader.MessageID, arg.MessageBoxed.GetMessageType())\n \tif ri.ReadMsgid == ri.MaxMsgid {\n \t\tm.readMsgid[arg.ConversationID.String()] = inserted.ServerHeader.MessageID\n \t}\n\nCodereview: ", "role": "user" }, { "content": "Do you want to keep this? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -100,12 +100,9 @@ func (m *MergeChecker) Check(region *core.RegionInfo) []*Operator {\n \n \tprev, next := m.cluster.GetAdjacentRegions(region)\n \n-\tvar target *core.RegionInfo\n-\ttargetNext := m.checkTarget(region, next, target)\n-\ttarget = m.checkTarget(region, prev, target)\n-\tif target != targetNext && m.cluster.GetEnableOneWayMerge() {\n-\t\tcheckerCounter.WithLabelValues(\"merge_checker\", \"skip_left\").Inc()\n-\t\ttarget = targetNext\n+\ttarget := m.checkTarget(region, next, nil)\n+\tif !m.cluster.GetEnableOneWayMerge() {\n+\t\ttarget = m.checkTarget(region, prev, target)\n \t}\n \n \tif target == nil {\n\nCodereview: ", "role": "user" }, { "content": "BTW, do we need to keep the metrics? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -165,7 +165,8 @@ func getIPAMConfig(clusterNetworks []common.ClusterNetwork, localSubnet string)\n // Start the CNI server and start processing requests from it\n func (m *podManager) Start(socketPath string, localSubnetCIDR string, clusterNetworks []common.ClusterNetwork) error {\n \tif m.enableHostports {\n-\t\tm.hostportSyncer = kubehostport.NewHostportSyncer()\n+\t\tiptInterface := utiliptables.New(utilexec.New(), utildbus.New(), utiliptables.ProtocolIpv4)\n+\t\tm.hostportSyncer = kubehostport.NewHostportSyncer(iptInterface)\n \t}\n \n \tvar err error\n\nCodereview: ", "role": "user" }, { "content": "is this a boring change? cc @openshift/sig-networking </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -614,6 +614,8 @@ func (m *bpfEndpointManager) attachDataIfaceProgram(ifaceName string, polDirecti\n \tepType := tc.EpTypeHost\n \tif ifaceName == \"tunl0\" {\n \t\tepType = tc.EpTypeTunnel\n+\t} else if ifaceName == \"wireguard.cali\" {\n+\t\tepType = tc.EpTypeWireguard\n \t}\n \tap := m.calculateTCAttachPoint(epType, polDirection, ifaceName)\n \tap.HostIP = m.hostIP\nCodereview: ", "role": "user" } ]
edabcef092cf4db9
{ "callgraph": "[No CFG could be retrieved]", "msg": "can we remove this since `getDocValues` already returns an iterator? (we might need to do `T extends DocIdSetIterator` above)", "patch": "@@ -21,12 +21,10 @@ import java.io.IOException;\n \n import org.apache.lucene.codecs.DocValuesConsumer;\n import org.apache.lucene.search.DocIdSetIterator;\n-import org.apache.lucene.search.SortField;\n \n-abstract class DocValuesWriter {\n- abstract void finish(int numDoc);\n+abstract class DocValuesWriter<T> {\n abstract void flush(SegmentWriteState state, Sorter.DocMap sortMap, DocValuesConsumer consumer) throws IOException;\n- abstract Sorter.DocComparator getDocComparator(int numDoc, SortField sortField) throws IOException;\n+ abstract T getDocValues();\n abstract DocIdSetIterator getDocIdSet();\n \n }", "summary": "abstract Flush the writer." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -212,7 +212,7 @@ public abstract class HiveRegister implements Closeable {\n * @param tableName the table name\n * @throws IOException\n */\n- public abstract void dropTableIfExists(String dbName, String tableName) throws IOException;\n+ public abstract void dropTableIfExists(String dbName, String tableName, String azkabanUrl, String metastoreURI) throws IOException;\n \n /**\n * Drop a partition if exists.\n\nCodereview: ", "role": "user" }, { "content": "You shouldn't modify public APIs. Furthermore, these parameters shouldn't be part of this method. The HiveRegister implementation must already know the metastoreURI, while the azkabanUri should be injected into the EventSubmitted. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -109,7 +109,7 @@ public abstract class AbstractJDBCDriver {\n protected abstract void createSchema() throws SQLException;\n \n protected final void createTable(String... schemaSqls) throws SQLException {\n- createTableIfNotExists(connection, sqlProvider.getTableName(), schemaSqls);\n+ createTableIfNotExists(sqlProvider.getTableName(), schemaSqls);\n }\n \n private void connect() throws SQLException {\n\nCodereview: ", "role": "user" }, { "content": "easier to ask than reading the code :) Why removing this parameter here? (sorry if I'm lazy.. I have a bunch of other PRs to check.. so it was easier to ask). </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -182,7 +182,7 @@ public abstract class AbstractSpecExecutor extends AbstractIdleService implement\n \n abstract protected void shutDown() throws Exception;\n \n- abstract public Future<? extends SpecProducer> getProducer();\n+ abstract public Future<? extends SpecProducer<Spec>> getProducer();\n \n abstract public Future<String> getDescription();\n }\n\nCodereview: ", "role": "user" }, { "content": "Will this have any impact on the serialization/deserialization of Dags in the DagManager mode? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -377,5 +377,5 @@ public abstract class AbstractConditionsAttachment extends DefaultAttachment imp\n }\n \n @Override\n- public void validate(final GameData data) throws GameParseException {}\n+ public abstract void validate(final GameData data) throws GameParseException;\n }\n\nCodereview: ", "role": "user" }, { "content": "Since all descendants implement this method, I think you can just remove this override, as it will be inherited from the superclass. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -28,7 +28,7 @@ public abstract class MetricsReporter {\n /**\n * Push out metrics at scheduled intervals\n */\n- public abstract void start();\n+ public abstract void start() throws IOException;\n \n /**\n * Deterministically push out metrics\n\nCodereview: ", "role": "user" }, { "content": "Would get removed as pointed above. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -21,12 +21,10 @@ import java.io.IOException;\n \n import org.apache.lucene.codecs.DocValuesConsumer;\n import org.apache.lucene.search.DocIdSetIterator;\n-import org.apache.lucene.search.SortField;\n \n-abstract class DocValuesWriter {\n- abstract void finish(int numDoc);\n+abstract class DocValuesWriter<T> {\n abstract void flush(SegmentWriteState state, Sorter.DocMap sortMap, DocValuesConsumer consumer) throws IOException;\n- abstract Sorter.DocComparator getDocComparator(int numDoc, SortField sortField) throws IOException;\n+ abstract T getDocValues();\n abstract DocIdSetIterator getDocIdSet();\n \n }\nCodereview: ", "role": "user" } ]
6cbe5b01a8dd4552
{ "callgraph": "[SendWindowSize->[sendWindowSize],EnsureMinimumWindowSize->[Lock,MinByteCount,startNewAutoTuningEpoch,Unlock],IsNewlyBlocked->[sendWindowSize],GetWindowUpdate->[Lock,Debugf,getWindowUpdate,Unlock],IncrementHighestReceived->[Lock,checkFlowControlViolation,Unlock,Error,Sprintf]]", "msg": "How often do we expect this to trigger? Should we maybe put it behind an if logger.Debug()?", "patch": "@@ -78,6 +78,7 @@ func (c *connectionFlowController) GetWindowUpdate() protocol.ByteCount {\n func (c *connectionFlowController) EnsureMinimumWindowSize(inc protocol.ByteCount) {\n \tc.mutex.Lock()\n \tif inc > c.receiveWindowSize {\n+\t\tc.logger.Debugf(\"Increasing receive flow control window for the connection to %d kB, in response to stream flow control window increase\", c.receiveWindowSize/(1<<10))\n \t\tc.receiveWindowSize = utils.MinByteCount(inc, c.maxReceiveWindowSize)\n \t\tc.startNewAutoTuningEpoch()\n \t}", "summary": "EnsureMinimumWindowSize ensures that the receive window size is at least as large as the maximum." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -97,6 +97,18 @@ func (c *client) PublishEvents(\n // returning the total number of events sent (due to window size, or acks until\n // failure).\n func (c *client) publishWindowed(data []outputs.Data) (int, error) {\n+\tif c.ttl != nil {\n+\t\tselect {\n+\t\tcase <-c.ttl:\n+\t\t\tif err := c.Close(); err != nil {\n+\t\t\t\treturn 0, err\n+\t\t\t}\n+\t\t\tif err := c.Connect(0); err != nil {\n+\t\t\t\treturn 0, err\n+\t\t\t}\n+\t\tdefault:\n+\t\t}\n+\t}\n \tif len(data) == 0 {\n \t\treturn 0, nil\n \t}\n\nCodereview: ", "role": "user" }, { "content": "introduce a `reconnect` method + consider window sizing. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -30,7 +30,7 @@ import org.apache.beam.sdk.transforms.GroupByKey;\n import org.joda.time.Instant;\n \n /**\n- * {@link Trigger Triggers} control when the elements for a specific key and window are output. As\n+ * Triggers control when the elements for a specific key and window are output. As\n * elements arrive, they are put into one or more windows by a {@link Window} transform and its\n * associated {@link WindowFn}, and then passed to the associated {@link Trigger} to determine if\n * the {@link BoundedWindow Window's} contents should be output.\n\nCodereview: ", "role": "user" }, { "content": "You just don't like the self-link? My default is to link the heck out of things - you never know when someone might want to click or copy link destination, etc. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -556,12 +556,12 @@ func (c *client) handleDispatcher(dispatcherCtx context.Context, dc string, tsoD\n \t// Normal connection creating, it will be affected by the `enableForwarding`.\n \tcreateTSOConnection := c.tryConnect\n \tif c.enableTSOFollowerProxy && dc == globalDCLocation /* only support Global TSO proxy now */ {\n-\t\tcreateTSOConnection = c.tryConnectToFollowerProxy\n+\t\tcreateTSOConnection = c.tryConnectToProxy\n \t}\n \tfor {\n \t\t// If the tso stream for the corresponding dc-location has not been created yet or needs to be re-created,\n \t\t// we will try to create the stream first.\n-\t\tif stream == nil {\n+\t\tif len(connectionCtxs) == 0 {\n \t\t\tif needUpdate {\n \t\t\t\terr = c.updateMember()\n \t\t\t\tif err != nil {\n\nCodereview: ", "role": "user" }, { "content": "Try to reconnect if and only after all connections are disconnected. This will cause 1. The duration fluctuates when reconnecting. 2. Some PDs no longer accept tso requests after an error occurs (restart, network fluctuation). 3. The new scale-out PD cannot balance the load. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -47,15 +47,15 @@ func (c *console) Close() error {\n func (c *console) PublishEvent(\n \ts op.Signaler,\n \topts outputs.Options,\n-\tevent common.MapStr,\n+\tevent outputs.Data,\n ) error {\n \tvar jsonEvent []byte\n \tvar err error\n \n \tif c.config.Pretty {\n-\t\tjsonEvent, err = json.MarshalIndent(event, \"\", \" \")\n+\t\tjsonEvent, err = json.MarshalIndent(event.Event, \"\", \" \")\n \t} else {\n-\t\tjsonEvent, err = json.Marshal(event)\n+\t\tjsonEvent, err = json.Marshal(event.Event)\n \t}\n \tif err != nil {\n \t\tlogp.Err(\"Fail to convert the event to JSON (%v): %#v\", err, event)\n\nCodereview: ", "role": "user" }, { "content": "can we renamed the field itself also to data? Otherwise we have inception below :-) </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -397,7 +397,7 @@ public class DefaultHttp2OutboundFlowController implements Http2OutboundFlowCont\n /**\n * The outbound flow control state for a single stream.\n */\n- private final class OutboundFlowState implements FlowState {\n+ final class OutboundFlowState implements FlowState {\n private final Queue<Frame> pendingWriteQueue;\n private final Http2Stream stream;\n private int window = initialWindowSize;\n\nCodereview: ", "role": "user" }, { "content": "If you're opening this up for testing, maybe make all mutation methods private? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -78,6 +78,7 @@ func (c *connectionFlowController) GetWindowUpdate() protocol.ByteCount {\n func (c *connectionFlowController) EnsureMinimumWindowSize(inc protocol.ByteCount) {\n \tc.mutex.Lock()\n \tif inc > c.receiveWindowSize {\n+\t\tc.logger.Debugf(\"Increasing receive flow control window for the connection to %d kB, in response to stream flow control window increase\", c.receiveWindowSize/(1<<10))\n \t\tc.receiveWindowSize = utils.MinByteCount(inc, c.maxReceiveWindowSize)\n \t\tc.startNewAutoTuningEpoch()\n \t}\nCodereview: ", "role": "user" } ]
9665b5089c93d445
{ "callgraph": "[HttpAccess->[init->[HttpAccess],getOkHttpClient->[build],getOkHttpClientBuilder->[UserAgentInterceptor,build,addNetworkInterceptor],hasNetwork->[getActiveNetworkInfo,isConnected],UserAgentInterceptor->[intercept->[request,proceed,build]],getSystemService]]", "msg": "This now throws when running tests (maybe the move to java 11??). Do we want to keep it?", "patch": "@@ -69,7 +69,6 @@ public class HttpAccess {\n * Initializes HttpAccess. Should be called from the application.\n */\n public static void init(Context app) {\n- assert DEFAULT == null : \"HttpAccess.init should be called once per process\";\n DEFAULT = new HttpAccess(app, null /* user agent will be calculated at request time */);\n }\n ", "summary": "Initializes the HTTPAccess class." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -117,9 +117,8 @@ public abstract class Telemetry implements ExtensionPoint {\n *\n * This method is called periodically, once per content submission.\n *\n- * @return The JSON payload\n+ * @return The JSON payload, or null if no content should be submitted.\n */\n- @Nonnull\n public abstract JSONObject createContent();\n \n public static ExtensionList<Telemetry> all() {\n\nCodereview: ", "role": "user" }, { "content": "You could add `@Nullable` or `@CheckForNull` (not sure what the difference is). </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -49,8 +49,6 @@ public final class Unix {\n \n /**\n * Internal method... Should never be called from the user.\n- *\n- * @param registerTask\n */\n @UnstableApi\n public static void registerInternal(Runnable registerTask) {\n\nCodereview: ", "role": "user" }, { "content": "Keep the `@param` tag? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -230,8 +230,11 @@ public abstract class UnboundedSource<\n * <p>All elements read up until this method is called will be processed together as a bundle.\n * (An element is considered 'read' if it could be returned by a call to {@link #getCurrent}.)\n * Once the result of processing those elements and the returned checkpoint have been durably\n- * committed, {@link CheckpointMark#finalizeCheckpoint} will (eventually) be called on the\n- * returned {@link CheckpointMark} object.\n+ * committed, {@link CheckpointMark#finalizeCheckpoint} will be called at most once at some\n+ * later point on the returned {@link CheckpointMark} object. Checkpoint finalization is\n+ * best-effort, and checkpoints may not be finalized. If duplicate elements may be produced if\n+ * checkpoints are not finalized in a timely manner, {@link UnboundedSource#requiresDeduping()}\n+ * should be overridden.\n *\n * <p>The returned object should not be modified.\n *\n\nCodereview: ", "role": "user" }, { "content": "And getRecordId should be overridden to provide unique IDs </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -125,12 +125,15 @@ public class BufferedPublisher<T> implements Publisher<T> {\n /**\n * If you set a drain handler. It will be called if, after delivery is attempted there are zero\n * elements buffered internally and there is demand from the subscriber for more elements. Drain\n- * handlers are one shot handlers, after being it will never be called more than once.\n+ * handlers are one shot handlers, after being called it will never be called more than once.\n *\n * @param handler The handler\n */\n public void drainHandler(final Runnable handler) {\n checkContext();\n+ if (drainHandler != null) {\n+ throw new IllegalStateException(\"drainHandler already set\");\n+ }\n this.drainHandler = handler;\n }\n \n\nCodereview: ", "role": "user" }, { "content": "nit: validate params that will be stored in object state; ensuring object does not get into an invalid state, i.e. null check `handler`. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -94,9 +94,9 @@ class HllCountMergePartialFn<HllT>\n @Override\n public byte[] extractOutput(@Nullable HyperLogLogPlusPlus<HllT> accumulator) {\n if (accumulator == null) {\n- throw new IllegalStateException(\n- \"HllCountMergePartialFn.extractOutput() should not be called on a null accumulator.\");\n+ return new byte[0];\n+ } else {\n+ return accumulator.serializeToByteArray();\n }\n- return accumulator.serializeToByteArray();\n }\n }\n\nCodereview: ", "role": "user" }, { "content": "We don't need a defaultValue() implementation in this class because the accumulator is different and can encode \"we haven't seen any input yet...\" -- correct? (Ideally, we'd have more symmetry between Init and MergePartial, but that's a detail). </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -69,7 +69,6 @@ public class HttpAccess {\n * Initializes HttpAccess. Should be called from the application.\n */\n public static void init(Context app) {\n- assert DEFAULT == null : \"HttpAccess.init should be called once per process\";\n DEFAULT = new HttpAccess(app, null /* user agent will be calculated at request time */);\n }\n \nCodereview: ", "role": "user" } ]
9073a4fd6c2c8180
{ "callgraph": "[BatchActionTransport->[reject->[commit],ack->[getMessage,commit,getResourceId,getResult,getId,markEntry,last],get->[commit,beginTransaction,fetchAssociative]]]", "msg": "As far as I can see you're not rollbacking transaction anywhere. This could potentially cause further issues(and very hard to debug ones) with not synchronized transactions between message handling. Is the transaction required in this place anyway? You seem only to be fetching data here. ack method is performing some updates so it makes sense", "patch": "@@ -16,6 +16,11 @@ use Ergonode\\BatchAction\\Domain\\Entity\\BatchActionId;\n use Ergonode\\SharedKernel\\Domain\\AggregateId;\n use Symfony\\Component\\Messenger\\Stamp\\HandledStamp;\n use Ergonode\\BatchAction\\Domain\\Repository\\BatchActionRepositoryInterface;\n+use Ergonode\\Core\\Application\\Security\\User\\CachedUser;\n+use Ergonode\\Account\\Domain\\Repository\\UserRepositoryInterface;\n+use Ergonode\\SharedKernel\\Domain\\Aggregate\\UserId;\n+use Ergonode\\BatchAction\\Domain\\Event\\BatchActionEndedEvent;\n+use Ergonode\\Core\\Application\\Messenger\\Stamp\\UserStamp;\n \n class BatchActionTransport implements TransportInterface\n {", "summary": "Creates a transport that processes a single batch action. Mark the last handled stamp for the message." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -19,11 +19,8 @@ use Sulu\\Bundle\\MediaBundle\\Entity\\MediaRepositoryInterface;\n use Sulu\\Bundle\\MediaBundle\\Media\\Exception\\CollectionNotFoundException;\n use Sulu\\Bundle\\MediaBundle\\Media\\Exception\\CollectionTypeNotFoundException;\n use Sulu\\Bundle\\MediaBundle\\Media\\FormatManager\\FormatManagerInterface;\n-use Sulu\\Component\\Rest\\ListBuilder\\Doctrine\\FieldDescriptor\\DoctrineJoinDescriptor;\n use Sulu\\Component\\Rest\\ListBuilder\\Doctrine\\FieldDescriptor\\DoctrineFieldDescriptor;\n-use Doctrine\\Common\\Persistence\\ObjectManager;\n-use Sulu\\Bundle\\MediaBundle\\Entity\\Collection as CollectionEntity;\n-use Sulu\\Bundle\\MediaBundle\\Api\\Collection;\n+use Sulu\\Component\\Rest\\ListBuilder\\Doctrine\\FieldDescriptor\\DoctrineJoinDescriptor;\n use Sulu\\Component\\Security\\Authentication\\UserRepositoryInterface;\n \n class DefaultCollectionManager implements CollectionManagerInterface\n\nCodereview: ", "role": "user" }, { "content": "Would it be a lot of work to rename this to just to `CollectionManager`? We never use this Default-prefix anywhere else... </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -25,9 +25,11 @@\n \n namespace LibreNMS\\OS;\n \n+use App\\Models\\TnmsAlarm;\n use App\\Models\\TnmsneInfo;\n use App\\Observers\\ModuleModelObserver;\n use LibreNMS\\Interfaces\\Polling\\OSPolling;\n+use LibreNMS\\Util\\ModuleModelObserver;\n use Log;\n \n class Coriant extends \\LibreNMS\\OS implements OSPolling\n\nCodereview: ", "role": "user" }, { "content": "A parse error occurred: Cannot use LibreNMS\\Util\\ModuleModelObserver as ModuleModelObserver because the name is already in use </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -26,9 +26,9 @@ namespace App;\n \n use App\\Models\\Device;\n use App\\Models\\Notification;\n-use Auth;\n use Cache;\n use Carbon\\Carbon;\n+use Illuminate\\Support\\Facades\\Auth;\n use LibreNMS\\Config;\n use Toastr;\n \n\nCodereview: ", "role": "user" }, { "content": "This one is wrong, isn't it? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -9,9 +9,11 @@ use Friendica\\Core\\Config\\IConfig;\n use Friendica\\Core\\Hook;\n use Friendica\\Core\\L10n;\n use Friendica\\Core\\PConfig\\IPConfig;\n+use Friendica\\Model\\Notify;\n use Friendica\\Network\\HTTPException\\InternalServerErrorException;\n use Friendica\\Object\\EMail\\IEmail;\n use Friendica\\Protocol\\Email;\n+use Friendica\\Util\\EMailer\\NotifyMailBuilder;\n use Friendica\\Util\\EMailer\\SystemMailBuilder;\n use Psr\\Log\\LoggerInterface;\n \n\nCodereview: ", "role": "user" }, { "content": "Please remove this if it's only used in a doc block. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -11,6 +11,7 @@ use WPSEO_Shortlinker;\n use Yoast\\WP\\SEO\\Conditionals\\Open_Graph_Conditional;\n use Yoast\\WP\\SEO\\Presenters\\Admin\\Badge_Presenter;\n use Yoast\\WP\\SEO\\Presenters\\Admin\\Premium_Badge_Presenter;\n+use Yoast\\WP\\SEO\\Presenters\\Admin\\Alert_Presenter;\n use Yoast\\WP\\SEO\\Integrations\\Integration_Interface;\n use Yoast_Form;\n \n\nCodereview: ", "role": "user" }, { "content": "I see usually the `use` statements are in alphabetical order, but not sure if it's an actual policy... </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -16,6 +16,11 @@ use Ergonode\\BatchAction\\Domain\\Entity\\BatchActionId;\n use Ergonode\\SharedKernel\\Domain\\AggregateId;\n use Symfony\\Component\\Messenger\\Stamp\\HandledStamp;\n use Ergonode\\BatchAction\\Domain\\Repository\\BatchActionRepositoryInterface;\n+use Ergonode\\Core\\Application\\Security\\User\\CachedUser;\n+use Ergonode\\Account\\Domain\\Repository\\UserRepositoryInterface;\n+use Ergonode\\SharedKernel\\Domain\\Aggregate\\UserId;\n+use Ergonode\\BatchAction\\Domain\\Event\\BatchActionEndedEvent;\n+use Ergonode\\Core\\Application\\Messenger\\Stamp\\UserStamp;\n \n class BatchActionTransport implements TransportInterface\n {\nCodereview: ", "role": "user" } ]
fdb5f91c27e6b65b
{ "callgraph": "[WebEngineTab->[icon->[icon],title->[title],_error_page_workaround->[_show_error_page,url,search],__init__->[WebEngineElements,WebEngineScroller,WebEngineCaret,WebEngineAction,WebEngineSearch,WebEngineHistory,WebEngineZoom,WebEnginePrinting],stop->[stop],_on_history_trigger->[url,title],url->[url],_on_load_started->[clear],_init_stylesheet->[_remove_early_js,_inject_early_js],_on_authentication_required->[_show_error_page],_on_load_finished->[dump_async],_init_js->[_inject_early_js],_show_error_page->[set_html],shutdown->[exit_fullscreen,shutdown],_on_proxy_authentication_required->[_show_error_page]],WebEngineScroller->[page_down->[_repeated_key_press],at_top->[pos_px],up->[_repeated_key_press],page_up->[_repeated_key_press],right->[_repeated_key_press],left->[_repeated_key_press],down->[_repeated_key_press]],WebEngineCaret->[follow_selected->[clear,_follow_selected_cb],_on_mode_entered->[clear]],WebEngineSearch->[prev_result->[_find],next_result->[_find],search->[_find]],WebEngineHistory->[serialize->[serialize],deserialize->[deserialize],load_items->[_on_load_finished->[to_point],serialize,pos_px]]]", "msg": "We should probably use ctrl-enter if `tab` is given, just like in `follow_selected`?", "patch": "@@ -335,6 +335,11 @@ class WebEngineCaret(browsertab.AbstractCaret):\n \"\"\"\n if js_elem is None:\n return\n+ if js_elem == \"focused\":\n+ # we had a focused element, not a selected one. Just send <enter>\n+ self._tab.key_press(Qt.Key_Enter)\n+ return\n+\n assert isinstance(js_elem, dict), js_elem\n elem = webengineelem.WebEngineElement(js_elem, tab=self._tab)\n if tab:", "summary": "Callback for javascript which clicks the selected element." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -4972,7 +4972,16 @@ def nce_layer(input,\n \"\"\"\n if isinstance(input, LayerOutput):\n input = [input]\n+ assert not isinstance(param_attr, collections.Sequence)\n+ param_attr = [param_attr]\n+ else:\n+ if isinstance(param_attr, collections.Sequence):\n+ assert len(input) == len(param_attr)\n+ else:\n+ param_attr = [copy.deepcopy(param_attr) for _ in range(len(input))]\n+\n assert isinstance(input, collections.Sequence)\n+\n assert isinstance(label, LayerOutput)\n assert label.layer_type == LayerType.DATA\n if neg_distribution is not None:\n\nCodereview: ", "role": "user" }, { "content": "please add simple usage in annotation when input is not LayerOutput, i.e, add simple usage for else branch. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -4972,7 +4972,16 @@ def nce_layer(input,\n \"\"\"\n if isinstance(input, LayerOutput):\n input = [input]\n+ assert not isinstance(param_attr, collections.Sequence)\n+ param_attr = [param_attr]\n+ else:\n+ if isinstance(param_attr, collections.Sequence):\n+ assert len(input) == len(param_attr)\n+ else:\n+ param_attr = [copy.deepcopy(param_attr) for _ in range(len(input))]\n+\n assert isinstance(input, collections.Sequence)\n+\n assert isinstance(label, LayerOutput)\n assert label.layer_type == LayerType.DATA\n if neg_distribution is not None:\n\nCodereview: ", "role": "user" }, { "content": "please add simple usage in annotation when input is not LayerOutput, i.e, add simple usage for else branch. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -73,3 +73,16 @@ class AttachmentScoresTest(AllenNlpTestCase):\n # Neither batch element had a perfect labeled or unlabeled EM.\n assert metrics[\"LEM\"] == 0.0\n assert metrics[\"UEM\"] == 0.0\n+\n+ def test_attachment_scores_can_ignore_labels(self):\n+ scorer = AttachmentScores(ignore_classes=[1])\n+\n+ label_predictions = self.label_predictions\n+ # Change the predictions where the gold label is 1;\n+ # as we are ignoring 1, we should still get a perfect score.\n+ label_predictions[0, 3] = 2\n+ scorer(self.predictions, label_predictions,\n+ self.gold_indices, self.gold_labels, self.mask)\n+\n+ for value in scorer.get_metric().values():\n+ assert value == 1.0\n\nCodereview: ", "role": "user" }, { "content": "It seems weird to score things this way. But I guess the assumption is that you'll always get these right, so we should just remove them? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -73,3 +73,16 @@ class AttachmentScoresTest(AllenNlpTestCase):\n # Neither batch element had a perfect labeled or unlabeled EM.\n assert metrics[\"LEM\"] == 0.0\n assert metrics[\"UEM\"] == 0.0\n+\n+ def test_attachment_scores_can_ignore_labels(self):\n+ scorer = AttachmentScores(ignore_classes=[1])\n+\n+ label_predictions = self.label_predictions\n+ # Change the predictions where the gold label is 1;\n+ # as we are ignoring 1, we should still get a perfect score.\n+ label_predictions[0, 3] = 2\n+ scorer(self.predictions, label_predictions,\n+ self.gold_indices, self.gold_labels, self.mask)\n+\n+ for value in scorer.get_metric().values():\n+ assert value == 1.0\n\nCodereview: ", "role": "user" }, { "content": "It seems weird to score things this way. But I guess the assumption is that you'll always get these right, so we should just remove them? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -2001,10 +2001,14 @@ class State:\n \"\"\"\n if self.tree is not None:\n # The file was already parsed (in __init__()).\n- return\n+ return True\n \n manager = self.manager\n \n+ if matches_exclude(\n+ self.path, manager.options.exclude, manager.fscache, manager.options.verbosity >= 2):\n+ return False\n+\n # Can we reuse a previously parsed AST? This avoids redundant work in daemon.\n cached = self.id in manager.ast_cache\n modules = manager.modules\n\nCodereview: ", "role": "user" }, { "content": "You need to change the return type from `-> None` to `-> bool`. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -335,6 +335,11 @@ class WebEngineCaret(browsertab.AbstractCaret):\n \"\"\"\n if js_elem is None:\n return\n+ if js_elem == \"focused\":\n+ # we had a focused element, not a selected one. Just send <enter>\n+ self._tab.key_press(Qt.Key_Enter)\n+ return\n+\n assert isinstance(js_elem, dict), js_elem\n elem = webengineelem.WebEngineElement(js_elem, tab=self._tab)\n if tab:\nCodereview: ", "role": "user" } ]
44278f389b1cbc57
{ "callgraph": "[setupDifferentNamedPorts->[JoinHostPort,Sleep,createNetworkPolicy,Sprint,deleteNetworkpolicy,createServerPod,String,runNetcatCommandFromTestPod,Fatalf],StatsV1alpha1,Sleep,JoinHostPort,Sprint,Sprintf,CoreV1,podWaitForIPs,Fatalf,GetScale,TODO,Create,deleteNetworkpolicy,Deployments,runCommandFromPod,Get,setupDifferentNamedPorts,Add,Skipf,Poll,String,createNetworkPolicy,Unmarshal,Pods,getAntreaPodOnNode,AppsV1,Wait,Done,deleteService,Fatal,NetworkPolicyStats,Logf,createService,UpdateScale,ParseCIDR,Errorf,runNetcatCommandFromTestPod,deletePod]", "msg": "I think it will revert the change @antoninbas did on purpose 05eee251c9c53400277def576f92d614ca234898", "patch": "@@ -35,12 +35,13 @@ import (\n \t\"antrea.io/antrea/pkg/features\"\n )\n \n-func skipIfNetworkPolicyStatsDisabled(tb testing.TB, data *TestData) {\n-\tskipIfFeatureDisabled(tb, data, features.NetworkPolicyStats, true, true)\n+func skipIfNetworkPolicyStatsDisabled(tb testing.TB) {\n+\tskipIfFeatureDisabled(tb, features.NetworkPolicyStats, true, true)\n }\n \n-func TestNetworkPolicyStats(t *testing.T) {\n-\tskipIfNotIPv4Cluster(t)\n+// TestNetworkPolicy is the top-level test which contains all subtests for\n+// NetworkPolicy related test cases so they can share setup, teardown.\n+func TestNetworkPolicy(t *testing.T) {\n \tskipIfHasWindowsNodes(t)\n \n \tdata, err := setupTest(t)", "summary": "END of function testNetworkNetworkStats test - client -." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -12,7 +12,7 @@ import (\n \tcontext \"golang.org/x/net/context\"\n )\n \n-func TestNewTeamEKNotif(t *testing.T) {\n+func TestEphemeralNewTeamEKNotif(t *testing.T) {\n \ttt := newTeamTester(t)\n \tdefer tt.cleanup()\n \n\nCodereview: ", "role": "user" }, { "content": "these changes were just so we could run `go test --run TestEphemeral` to verify server side changes more easily </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -10,7 +10,7 @@ import (\n \t\"github.com/stretchr/testify/assert\"\n )\n \n-func TestIssue_ReplaceLabels(t *testing.T) {\n+func TestIssueReplaceLabels(t *testing.T) {\n \tassert.NoError(t, PrepareTestDatabase())\n \n \ttestSuccess := func(issueID int64, labelIDs []int64) {\n\nCodereview: ", "role": "user" }, { "content": "Why was this test renamed? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -5,14 +5,15 @@ import (\n \t\"fmt\"\n \t\"testing\"\n \n+\t\"log\"\n+\n \t\"github.com/hashicorp/terraform/helper/acctest\"\n \t\"github.com/hashicorp/terraform/helper/resource\"\n \t\"github.com/hashicorp/terraform/terraform\"\n \t\"google.golang.org/api/cloudkms/v1\"\n-\t\"log\"\n )\n \n-func TestAccGoogleKmsSecret_basic(t *testing.T) {\n+func TestAccKmsSecret_basic(t *testing.T) {\n \tt.Parallel()\n \n \tprojectOrg := getTestOrgFromEnv(t)\n\nCodereview: ", "role": "user" }, { "content": "Spacing is a little off. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -11,7 +11,7 @@ import (\n \t\"github.com/stretchr/testify/require\"\n )\n \n-func TestPipelineJobSpecErrorsController_Delete(t *testing.T) {\n+func TestPipelineJobSpecErrorsController_Delete_2(t *testing.T) {\n \tapp, client, _, jID, _, _ := setupJobSpecsControllerTestsWithJobs(t)\n \n \tdescription := \"job spec error description\"\n\nCodereview: ", "role": "user" }, { "content": "Why did the test name change? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -19,11 +19,13 @@ import (\n )\n \n func clearJobsDb(t *testing.T, db *gorm.DB) {\n+\tt.Helper()\n \terr := db.Exec(`TRUNCATE jobs, pipeline_runs, pipeline_specs, pipeline_task_runs CASCADE`).Error\n \trequire.NoError(t, err)\n }\n \n func TestPipelineORM_Integration(t *testing.T) {\n+\tt.Skip()\n \tconfig, oldORM, cleanupDB := cltest.BootstrapThrowawayORM(t, \"pipeline_orm\", true, true)\n \tconfig.Set(\"DEFAULT_HTTP_TIMEOUT\", \"30ms\")\n \tconfig.Set(\"MAX_HTTP_ATTEMPTS\", \"1\")\n\nCodereview: ", "role": "user" }, { "content": "Might wanna remove this? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -35,12 +35,13 @@ import (\n \t\"antrea.io/antrea/pkg/features\"\n )\n \n-func skipIfNetworkPolicyStatsDisabled(tb testing.TB, data *TestData) {\n-\tskipIfFeatureDisabled(tb, data, features.NetworkPolicyStats, true, true)\n+func skipIfNetworkPolicyStatsDisabled(tb testing.TB) {\n+\tskipIfFeatureDisabled(tb, features.NetworkPolicyStats, true, true)\n }\n \n-func TestNetworkPolicyStats(t *testing.T) {\n-\tskipIfNotIPv4Cluster(t)\n+// TestNetworkPolicy is the top-level test which contains all subtests for\n+// NetworkPolicy related test cases so they can share setup, teardown.\n+func TestNetworkPolicy(t *testing.T) {\n \tskipIfHasWindowsNodes(t)\n \n \tdata, err := setupTest(t)\nCodereview: ", "role": "user" } ]
cc0167f27e24098c
{ "callgraph": "[IsLordHowe,SetState,PathOfTempFile,CleanupPath,GetState,Bytes,NewMockStateManager,DoAndReturn,GetCodeHash,Get,BytesToHash160,IsAleutian,Any,Hash256b,NewInt,NewCachedBatch,String,EXPECT,IsKamchatka,IsGreenland,Snapshot,NotEqual,Hash160b,CommitContracts,Run,State,clear,Put,Commit,Nil,SelfState,BytesToHash256,GetCode,Cause,CreateStateConfig,NewController,NoError,New,Serialize,LoadOrCreateAccount,Equal,PutState,AnyTimes,SetCode,GetCommittedState,AddBalance,Address,Deserialize]", "msg": "`stateDB := NewStateDBAdapter(sm, 0, hash.ZeroHash256, NotFixTopicCopyBugOption())`", "patch": "@@ -66,9 +66,9 @@ func TestCreateContract(t *testing.T) {\n \taddr := identityset.Address(28)\n \t_, err = accountutil.LoadOrCreateAccount(sm, addr.String())\n \trequire.NoError(err)\n-\tstateDB := NewStateDBAdapter(sm, 0, !cfg.Genesis.IsAleutian(0),\n-\t\tcfg.Genesis.IsGreenland(0), cfg.Genesis.IsKamchatka(0),\n-\t\tcfg.Genesis.IsLordHowe(0), hash.ZeroHash256)\n+\topt := []StateDBAdapterOption{NotFixTopicCopyBugOption()}\n+\tstateDB := NewStateDBAdapter(sm, 0, hash.ZeroHash256, opt...)\n+\n \tcontract := addr.Bytes()\n \tvar evmContract common.Address\n \tcopy(evmContract[:], contract[:])", "summary": "Get a batch of state records for a given account. TestLoadStoreCommit tests if a code hash is not already present in the stateDB." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -30,13 +30,13 @@ type outerLinkV2WithMetadataEmbedder struct {\n func TestOuterLinkV2WithMetadataEmbedderEncode(t *testing.T) {\n \tvar o outerLinkV2WithMetadataEmbedder\n \t_, err := MsgpackEncode(o)\n-\trequire.Equal(t, errCodecEncodeSelf, err)\n+\trequireErrorHasSuffix(t, errCodecEncodeSelf, err)\n }\n \n func TestOuterLinkV2WithMetadataEmbedderDecode(t *testing.T) {\n \tvar o outerLinkV2WithMetadataEmbedder\n \terr := MsgpackDecode(&o, []byte{0x1, 0x2})\n-\trequire.Equal(t, errCodecDecodeSelf, err)\n+\trequireErrorHasSuffix(t, errCodecDecodeSelf, err)\n }\n \n type outerLinkV2WithMetadataPointerEmbedder struct {\n\nCodereview: ", "role": "user" }, { "content": "old codec still threw an error, but new codec skips encoding if it's nill I guess </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -33,11 +33,11 @@ func TestCreateWallet(t *testing.T) {\n \t_, tcs, cleanup := setupNTests(t, 2)\n \tdefer cleanup()\n \n-\tcreated, err := CreateWallet(context.Background(), tcs[0].G)\n+\tcreated, err := stellar.CreateWallet(context.Background(), tcs[0].G)\n \trequire.NoError(t, err)\n \trequire.True(t, created)\n \n-\tcreated, err = CreateWallet(context.Background(), tcs[0].G)\n+\tcreated, err = stellar.CreateWallet(context.Background(), tcs[0].G)\n \trequire.NoError(t, err)\n \trequire.False(t, created)\n \n\nCodereview: ", "role": "user" }, { "content": "Could these tests still use the service handlers when possible? That way they cover the most. In this particular case WalletInitLocal </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -425,9 +425,7 @@ func TestRelayTransferInnards(t *testing.T) {\n \trequire.True(t, len(out.FundTx.Signed) > 100)\n \n \tt.Logf(\"decrypt\")\n-\tappKey, err = stellar.RelayTransferKeyForDecryption(context.Background(), tcs[0].G, teamID, appKey.KeyGeneration)\n-\trequire.NoError(t, err)\n-\trelaySecrets, err := stellar.DecryptRelaySecretB64(out.EncryptedB64, appKey)\n+\trelaySecrets, err := stellar.DecryptRelaySecretB64(context.Background(), tcs[0].G, teamID, out.EncryptedB64)\n \trequire.NoError(t, err)\n \t_, accountID, _, err := libkb.ParseStellarSecretKey(relaySecrets.Sk.SecureNoLogString())\n \trequire.NoError(t, err)\n\nCodereview: ", "role": "user" }, { "content": "can you check the error on line 426 above too? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -55,11 +55,13 @@ func TestAuthenticateUserByToken(t *testing.T) {\n \tvar user models.User\n \n \ttoken, err := user.GenerateAuthToken()\n+\tassert.NoError(t, err, \"failed when generate auth token\")\n \tok, err := models.AuthenticateUserByToken(token, &user)\n \trequire.NoError(t, err)\n \tassert.True(t, ok, \"authentication must be successful\")\n \n \t_, err = user.GenerateAuthToken()\n+\tassert.NoError(t, err, \"failed to generate auth token\")\n \tok, err = models.AuthenticateUserByToken(token, &user)\n \trequire.NoError(t, err)\n \tassert.False(t, ok, \"authentication must fail with past token\")\n\nCodereview: ", "role": "user" }, { "content": "`failed to generate auth token` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -69,12 +69,10 @@ func TestVerifyNewBlock(t *testing.T) {\n \t}\n \tnode := New(host, consensus, testDBFactory, false)\n \n-\tselectedTxs, selectedStakingTxs := node.getTransactionsForNewBlock(common.Address{})\n-\tnode.Worker.CommitTransactions(\n-\t\tselectedTxs, selectedStakingTxs, common.Address{},\n-\t\tfunc([]types.RPCTransactionError) {},\n-\t)\n-\n+\ttxs := make(map[common.Address]types.Transactions)\n+\tstks := types2.StakingTransactions{}\n+\tnode.Worker.CommitTransactions(txs, stks, common.Address{},\n+\t\tfunc([]types.RPCTransactionError) {})\n \tblock, _ := node.Worker.FinalizeNewBlock([]byte{}, []byte{}, 0, common.Address{}, nil, nil)\n \n \tif err := node.VerifyNewBlock(block); err != nil {\n\nCodereview: ", "role": "user" }, { "content": "we don't have staking tx in s3, right? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -66,9 +66,9 @@ func TestCreateContract(t *testing.T) {\n \taddr := identityset.Address(28)\n \t_, err = accountutil.LoadOrCreateAccount(sm, addr.String())\n \trequire.NoError(err)\n-\tstateDB := NewStateDBAdapter(sm, 0, !cfg.Genesis.IsAleutian(0),\n-\t\tcfg.Genesis.IsGreenland(0), cfg.Genesis.IsKamchatka(0),\n-\t\tcfg.Genesis.IsLordHowe(0), hash.ZeroHash256)\n+\topt := []StateDBAdapterOption{NotFixTopicCopyBugOption()}\n+\tstateDB := NewStateDBAdapter(sm, 0, hash.ZeroHash256, opt...)\n+\n \tcontract := addr.Bytes()\n \tvar evmContract common.Address\n \tcopy(evmContract[:], contract[:])\nCodereview: ", "role": "user" } ]
f1b43da82793436e
{ "callgraph": "[Codebase->[reloadFiles->[loadAnalyzer],getSymbolLocation->[getDeclaringMethodId,getFileContents],getCasedMethodId->[getCasedMethodId],getOverriddenMethodIds->[getOverriddenMethodIds],getCompletionDataAtPosition->[getFileContents],classImplements->[classImplements],classHasCorrectCasing->[classHasCorrectCasing],addTemporaryFileChanges->[addTemporaryFileChanges],classOrInterfaceExists->[classOrInterfaceExists],fileExists->[fileExists],getStatementsForFile->[getStatementsForFile],getSymbolInformation->[getDeclaringMethodId],getMethodReturnTypeLocation->[getMethodReturnTypeLocation],getMethodReturnType->[getMethodReturnType],interfaceExtends->[interfaceExtends],getReferenceAtPosition->[getFileContents],getSignatureInformation->[getDeclaringMethodId],getDeclaringMethodId->[getDeclaringMethodId],methodExists->[methodExists],traitHasCorrectCase->[traitHasCorrectCase],getFunctionArgumentAtPosition->[getFileContents],removeTemporaryFileChanges->[removeTemporaryFileChanges],classExists->[classExists],isVariadic->[isVariadic],scanFiles->[scanFiles],interfaceHasCorrectCasing->[interfaceHasCorrectCasing],getCompletionItemsForPartialSymbol->[getFileContents],getAppearingMethodId->[getAppearingMethodId],getMethodParams->[getMethodParams],queueClassLikeForScanning->[queueClassLikeForScanning],getParentInterfaces->[getParentInterfaces],addFilesToAnalyze->[addFilesToAnalyze],interfaceExists->[interfaceExists],getMethodReturnsByRef->[getMethodReturnsByRef],classExtends->[classExtends]]]", "msg": "As mentioned below, I'm not sure why this is only allowing refs that are tagged with `*` at the start!", "patch": "@@ -1279,10 +1279,13 @@ class Codebase\n }\n \n foreach ($reference_map as $start_pos => [$end_pos, $possible_reference]) {\n- if ($offset < $start_pos || $possible_reference[0] !== '*') {\n+ if ($offset < $start_pos) {\n continue;\n }\n-\n+ // If the reference precedes a \"::\" then treat it as a class reference.\n+ if ($offset - $end_pos === 2 && substr($file_contents, $end_pos, 2) === '::') {\n+ return [$possible_reference, '::', $offset];\n+ }\n if ($offset - $end_pos === 0) {\n $recent_type = $possible_reference;\n ", "summary": "Get completion data at a given position. Recent type." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -679,8 +679,8 @@ define([\n \n function computeRectangle(positions, ellipsoid, width, cornerType) {\n var cleanPositions = arrayRemoveDuplicates(positions, Cartesian3.equalsEpsilon);\n- var length = cleanPositions.length - 1;\n- if (length === 0 || width === 0) {\n+ var length = cleanPositions.length;\n+ if (length < 2 || width <= 0) {\n return new Rectangle();\n }\n var halfWidth = width * 0.5;\n\nCodereview: ", "role": "user" }, { "content": "How hard is it to write a test for the updated code in this function. One option would be exposing `computeRectangle` as a private `CorridorGeometry._computeRectangle` so that it can be tested directly. CC @hpinkos </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -79,11 +79,9 @@ public class SqlSplitter {\n }\n \n // end of multiple line comment\n- if (multiLineComment && character == '/' && text.charAt(index - 1) == '*') {\n+ if (multiLineComment && (index - 1) >= 0 && text.charAt(index - 1) == '/'\n+ && (index - 2) >= 0 && text.charAt(index - 2) == '*') {\n multiLineComment = false;\n- if (query.toString().trim().isEmpty()) {\n- continue;\n- }\n }\n \n if (character == '\\'') {\n\nCodereview: ", "role": "user" }, { "content": "Can we replace ` (index - 1) >= 0` with ` (index - 2) >= 0` and just skip it later? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -79,11 +79,9 @@ public class SqlSplitter {\n }\n \n // end of multiple line comment\n- if (multiLineComment && character == '/' && text.charAt(index - 1) == '*') {\n+ if (multiLineComment && (index - 1) >= 0 && text.charAt(index - 1) == '/'\n+ && (index - 2) >= 0 && text.charAt(index - 2) == '*') {\n multiLineComment = false;\n- if (query.toString().trim().isEmpty()) {\n- continue;\n- }\n }\n \n if (character == '\\'') {\n\nCodereview: ", "role": "user" }, { "content": "Can we replace ` (index - 1) >= 0` with ` (index - 2) >= 0` and just skip it later? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -477,6 +477,14 @@ final class DocumentationNormalizer implements NormalizerInterface\n if (null !== $type && !$type->isCollection() && (null !== $className = $type->getClassName()) && $this->resourceClassResolver->isResourceClass($className)) {\n $propertyData['owl:maxCardinality'] = 1;\n }\n+ // Add doc informations\n+ $docInformations = $propertyMetadata->getAttributes()['doc_informations'] ?? [];\n+ foreach ($docInformations as $infoKey => $infoValue) {\n+ if ('@id' === $infoKey || '@type' === $infoKey) {\n+ continue;\n+ }\n+ $propertyData[$infotKey] = $infoValue;\n+ }\n \n $property = [\n '@type' => 'hydra:SupportedProperty',\n\nCodereview: ", "role": "user" }, { "content": "Why excluding those keys (maybe can we just let the user override this if he wants to)? </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -477,6 +477,15 @@ final class DocumentationNormalizer implements NormalizerInterface\n if (null !== $type && !$type->isCollection() && (null !== $className = $type->getClassName()) && $this->resourceClassResolver->isResourceClass($className)) {\n $propertyData['owl:maxCardinality'] = 1;\n }\n+ // Add extended JSON-LD context informations\n+ // @see https://api-platform.com/docs/core/extending-jsonld-context\n+ $jsonldContext = $propertyMetadata->getAttributes()['jsonld_context'] ?? [];\n+ foreach ($jsonldContext as $contextKey => $contextValue) {\n+ if ($contextKey === '@id' || $contextKey === '@type') {\n+ continue;\n+ }\n+ $propertyData[$contextKey] = $contextValue;\n+ }\n \n $property = [\n '@type' => 'hydra:SupportedProperty',\n\nCodereview: ", "role": "user" }, { "content": "Should be yoda style </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -1279,10 +1279,13 @@ class Codebase\n }\n \n foreach ($reference_map as $start_pos => [$end_pos, $possible_reference]) {\n- if ($offset < $start_pos || $possible_reference[0] !== '*') {\n+ if ($offset < $start_pos) {\n continue;\n }\n-\n+ // If the reference precedes a \"::\" then treat it as a class reference.\n+ if ($offset - $end_pos === 2 && substr($file_contents, $end_pos, 2) === '::') {\n+ return [$possible_reference, '::', $offset];\n+ }\n if ($offset - $end_pos === 0) {\n $recent_type = $possible_reference;\n \nCodereview: ", "role": "user" } ]
789077752986ed2e
{ "callgraph": "[DeepCopyAsyncCuda->[get_deep_copy_stream,CUDA_SAFE_CALL],attach_texture_object->[CUDA_SAFE_CALL],CUDA_SAFE_CALL->[CUDA_SAFE_CALL],deallocate->[CUDA_SAFE_CALL],reallocate_tracked->[allocate,get_label],allocate_tracked->[allocate],defined->[deallocate]]", "msg": "Should this be using the `CUDA_SAFE_CALL` macro here?", "patch": "@@ -917,6 +917,7 @@ void *cuda_resize_scratch_space(std::int64_t bytes, bool force_shrink) {\n \n void cuda_prefetch_pointer(const Cuda &space, const void *ptr, size_t bytes,\n bool to_device) {\n+ if ((ptr == nullptr) || (bytes == 0)) return;\n cudaPointerAttributes attr;\n cudaPointerGetAttributes(&attr, ptr);\n // I measured this and it turns out prefetching towards the host slows", "summary": "cuda_prefetch_pointer - Cuda prefetch pointer KOKKOS_ENABLE_CUDA KOKKOS_PREVENT_." }
[ { "content": "Please Give FORMAL Codereview for software developers in one sentence from the given diff hunk. Don’t start with Codereview/review. Just give the answer. Five examples are given before with code and code review and the code to work on is given after.", "role": "user" }, { "content": "Code: \t@@ -46,7 +46,7 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,\n size_t n;\n size_t len = length;\n \n- if (length == 0)\n+ if (length / AES_BLOCK_SIZE == 0)\n return;\n \n OPENSSL_assert(in && out && key && ivec);\n\nCodereview: ", "role": "user" }, { "content": "we have this `OPENSSL_assert((length % AES_BLOCK_SIZE) == 0)` a few lines later, since this is a void function there is no way of returning a result, so you could instead change the assert below to `if (!OPENSSL_assert(...)) return;` </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -913,11 +913,12 @@ void rfree(void *ptr)\n }\n \n void *rrealloc(void *ptr, enum mem_zone zone, uint32_t flags, uint32_t caps,\n-\t size_t bytes)\n+\t size_t bytes, size_t old_bytes)\n {\n \tstruct mm *memmap = memmap_get();\n \tvoid *new_ptr = NULL;\n \tuint32_t lock_flags;\n+\tsize_t copy_bytes = MIN(bytes, old_bytes);\n \n \tif (!bytes)\n \t\treturn new_ptr;\n\nCodereview: ", "role": "user" }, { "content": "Would go for just `min()` macro </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -3944,16 +3944,15 @@ inline void gcode_M105() {\n * Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.\n */\n inline void gcode_M109() {\n+ float temp;\n bool no_wait_for_cooling = true;\n \n if (setTargetedHotend(109)) return;\n if (marlin_debug_flags & DEBUG_DRYRUN) return;\n \n- LCD_MESSAGEPGM(MSG_HEATING);\n-\n no_wait_for_cooling = code_seen('S');\n if (no_wait_for_cooling || code_seen('R')) {\n- float temp = code_value();\n+ temp = code_value();\n setTargetHotend(temp, target_extruder);\n #if ENABLED(DUAL_X_CARRIAGE)\n if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)\n\nCodereview: ", "role": "user" }, { "content": "Should be `float temp = 0;` because it's comparing with 0 below </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -50,7 +50,7 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,\n unsigned char *ivec, const int enc)\n {\n size_t n;\n- size_t len = length;\n+ size_t len;\n \n if (length == 0)\n return;\n\nCodereview: ", "role": "user" }, { "content": "I am concerned about removing assignments in initializers, like this and by_dir.c line 231. The project has the habit of initializing things at declaration, to avoid \"maybe uninitialized\" errors, and removing these two seems like going too far. Especially since these are, as you point out, false positives. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -223,7 +223,8 @@ void BinBasedDEMFluidCoupledMapping<TDim, TBaseTypeOfSwimmingParticle>::VariingR\n ModelPart& r_fluid_model_part,\n const double& search_radius,\n const double& shape_factor, // it is the density function's maximum divided by its support's radius\n- bool must_search)\n+ bool must_search,\n+ bool use_drew_model)\n {\n KRATOS_TRY\n \n\nCodereview: ", "role": "user" }, { "content": "all these parameters should me moved to a Parameters object. For the future. </s>\n\n", "role": "assistant" }, { "content": "Code: \t@@ -917,6 +917,7 @@ void *cuda_resize_scratch_space(std::int64_t bytes, bool force_shrink) {\n \n void cuda_prefetch_pointer(const Cuda &space, const void *ptr, size_t bytes,\n bool to_device) {\n+ if ((ptr == nullptr) || (bytes == 0)) return;\n cudaPointerAttributes attr;\n cudaPointerGetAttributes(&attr, ptr);\n // I measured this and it turns out prefetching towards the host slows\nCodereview: ", "role": "user" } ]
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
81