Skip to content

Commit d58fb8c

Browse files
committed
Remove forgotten heredocs style and rearrange warning texts to improve source readability.
1 parent e4dc62d commit d58fb8c

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

lib/logstash/filters/elastic_integration.rb

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -475,25 +475,31 @@ def check_versions_alignment
475475
es_full_version = connected_es_version_info["number"]
476476

477477
if es_major_version > plugin_major_version
478-
logger.warn <<~WARNING
479-
This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version}
480-
WARNING
478+
logger.warn "This plugin v#{VERSION} is connected to a newer MAJOR " +
479+
"version of Elasticsearch v#{es_full_version}, and may " +
480+
"have trouble loading or running pipelines that use new " +
481+
"features; for the best experience, update this plugin " +
482+
"to at least v#{es_major_version}.#{es_minor_version}."
481483
elsif es_major_version < plugin_major_version
482-
logger.warn <<~WARNING
483-
This plugin v#{VERSION} is connected to an older MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use features that were deprecated before Elasticsearch v#{plugin_major_version}.0; for the best experience, align major/minor versions across the Elastic Stack.
484-
WARNING
484+
logger.warn "This plugin v#{VERSION} is connected to an older MAJOR " +
485+
"version of Elasticsearch v#{es_full_version}, and may " +
486+
"have trouble loading or running pipelines that use " +
487+
"features that were deprecated before Elasticsearch " +
488+
"v#{plugin_major_version}.0; for the best experience, " +
489+
"align major/minor versions across the Elastic Stack."
485490
elsif es_minor_version > plugin_minor_version
486-
logger.warn <<~WARNING
487-
This plugin v#{VERSION} is connected to a newer MINOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version}
488-
WARNING
491+
logger.warn "This plugin v#{VERSION} is connected to a newer MINOR " +
492+
"version of Elasticsearch v#{es_full_version}, and may " +
493+
"have trouble loading or running pipelines that use new " +
494+
"features; for the best experience, update this plugin to " +
495+
"at least v#{es_major_version}.#{es_minor_version}."
489496
elsif es_minor_version < plugin_minor_version
490-
logger.info <<~INFO
491-
This plugin v#{VERSION} is connected to an older MINOR version of Elasticsearch v#{es_full_version}; for the best experience, align major/minor versions across the Elastic Stack.
492-
INFO
497+
logger.info "This plugin v#{VERSION} is connected to an older MINOR " +
498+
"version of Elasticsearch v#{es_full_version}; for the best experience, " +
499+
"align major/minor versions across the Elastic Stack."
493500
else
494-
logger.debug <<~DEBUG
495-
This plugin v#{VERSION} is connected to the same MAJOR/MINOR version of Elasticsearch v#{es_full_version}.
496-
DEBUG
501+
logger.debug "This plugin v#{VERSION} is connected to the same MAJOR/MINOR " +
502+
"version of Elasticsearch v#{es_full_version}."
497503
end
498504
end
499505
end

spec/unit/elastic_integration_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@
744744
it "informs which version of ES the plugin is built from" do
745745
expected_message =
746746
"This plugin v#{version} is connected to the same MAJOR/MINOR version " +
747-
"of Elasticsearch v#{connected_es_version_info['number']}.\n"
747+
"of Elasticsearch v#{connected_es_version_info['number']}."
748748

749749
expect(mock_logger).to have_received(:info).with(base_message)
750750
expect(mock_logger).to have_received(:debug).with(expected_message)
@@ -770,7 +770,7 @@
770770
"This plugin v#{version} is connected to a newer MAJOR version of " +
771771
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or " +
772772
"running pipelines that use new features; for the best experience, " +
773-
"update this plugin to at least v#{connected_es_version_info['major']}.#{connected_es_version_info['minor']}\n"
773+
"update this plugin to at least v#{connected_es_version_info['major']}.#{connected_es_version_info['minor']}."
774774
}
775775
include_examples "version mismatch", :major, :behind, :info, :warn
776776
end
@@ -781,7 +781,7 @@
781781
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or " +
782782
"running pipelines that use features that were deprecated before " +
783783
"Elasticsearch v#{plugin_major_version}.0; for the best experience, " +
784-
"align major/minor versions across the Elastic Stack.\n"
784+
"align major/minor versions across the Elastic Stack."
785785
}
786786
include_examples "version mismatch", :major, :ahead, :info, :warn
787787
end
@@ -791,7 +791,7 @@
791791
"This plugin v#{version} is connected to a newer MINOR version of " +
792792
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or " +
793793
"running pipelines that use new features; for the best experience, " +
794-
"update this plugin to at least v#{connected_es_version_info['major']}.#{connected_es_version_info['minor']}\n"
794+
"update this plugin to at least v#{connected_es_version_info['major']}.#{connected_es_version_info['minor']}."
795795
}
796796
include_examples "version mismatch", :minor, :behind, :info, :warn
797797
end
@@ -800,7 +800,7 @@
800800
let(:expected_message) {
801801
"This plugin v#{version} is connected to an older MINOR version of " +
802802
"Elasticsearch v#{connected_es_version_info['number']}; for the best experience, " +
803-
"align major/minor versions across the Elastic Stack.\n"
803+
"align major/minor versions across the Elastic Stack."
804804
}
805805
include_examples "version mismatch", :minor, :ahead, :info, :info
806806
end

0 commit comments

Comments
 (0)